Skip to content

Commit 1dbbbf4

Browse files
committed
chore(maint): lint run-ci.py
1 parent 5ae7372 commit 1dbbbf4

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[flake8]
22
max-line-length=100
3-
ignore=D100, D101, D102, D103, D104, D105, D107, D400, E731
3+
ignore=D100, D101, D102, D103, D104, D105, D107, D400, E731, W503
44

55
exclude =
66
build

run-ci.py

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def get_android_bin_path() -> Path:
110110

111111

112112
def bind_gen(
113-
*, header_source: Path, output_file: Path, include_path: Path, dynamic_loading: bool
113+
*, header_source: Path, output_file: Path, include_path: Path, dynamic_loading: bool
114114
) -> None:
115115
args = []
116116
if dynamic_loading:
@@ -133,7 +133,7 @@ def bind_gen(
133133

134134
class Builder:
135135
def __init__(
136-
self, *, src_path: Path, build_profile: Profile, host_profile: Profile
136+
self, *, src_path: Path, build_profile: Profile, host_profile: Profile
137137
):
138138
self.src_path = src_path
139139
self.host_profile = host_profile
@@ -187,7 +187,9 @@ def _copy_includes(self, package_path: Path, depsConfig: DepsConfig) -> None:
187187
# This is necessary on 64bit android archs, as Clang doesn't build them by default,
188188
# and Google's NDK distribution doesn't take care of that either...
189189
@staticmethod
190-
def _armerge_soft_float128_compiler_rt_builtins(compiler_rt_lib: Path, output_path: Path, env: dict[str, str]):
190+
def _armerge_soft_float128_compiler_rt_builtins(
191+
compiler_rt_lib: Path, output_path: Path, env: dict[str, str]
192+
) -> None:
191193
f128_builtins = [
192194
"__addtf3",
193195
"__subtf3",
@@ -230,7 +232,7 @@ def _armerge_soft_float128_compiler_rt_builtins(compiler_rt_lib: Path, output_pa
230232
"__multc3",
231233
"__divtc3",
232234
]
233-
keep_symbol_args = [e for sym_name in f128_builtins for e in ['-k', sym_name]]
235+
keep_symbol_args = [e for sym_name in f128_builtins for e in ["-k", sym_name]]
234236

235237
tankerci.run(
236238
"armerge",
@@ -243,7 +245,7 @@ def _armerge_soft_float128_compiler_rt_builtins(compiler_rt_lib: Path, output_pa
243245
)
244246

245247
def _merge_all_libs(
246-
self, depsConfig: DepsConfig, package_path: Path, native_path: Path
248+
self, depsConfig: DepsConfig, package_path: Path, native_path: Path
247249
) -> None:
248250
with tankerci.working_directory(package_path):
249251
env = os.environ.copy()
@@ -266,18 +268,28 @@ def _merge_all_libs(
266268
ndk_arch = NDK_ARCH_TARGETS[self.arch]
267269
android_lib_path = android_bin_path / f"../sysroot/usr/lib/{ndk_arch}"
268270

269-
# Starting with NDK r23, Google in its infinite wisdom has decided to make things more interesting
271+
# Starting with NDK r23, Google in its infinite wisdom has decided to make things
272+
# more interesting
270273
# libgcc is gone, and now we use clang's libcxx and compiler-rt.
271-
# Unfortunately, the libcxx_static.a is currently missing soft float128 builtins for 64bit archs
272-
# (See https://reviews.llvm.org/D53608 and https://github.com/llvm/llvm-project/issues/51395)
274+
# Unfortunately, the libcxx_static.a is currently missing soft float128 builtins
275+
# for 64bit archs (See https://reviews.llvm.org/D53608 and
276+
# https://github.com/llvm/llvm-project/issues/51395)
273277
# It is possible to find those symbols in the separate libclang_rt.builtins libs
274-
# However, we can't pull in all of rt.builtins, or we will have duplicate symbols and fail linking
275-
if self.arch in ['x86_64', 'armv8']:
278+
# However, we can't pull in all of rt.builtins, or we will have duplicate symbols
279+
# and fail linking
280+
if self.arch in ["x86_64", "armv8"]:
276281
compiler_rt_arch = CLANG_RT_ARCH_TARGETS[self.arch]
277-
compiler_rt_dir = android_bin_path / f"../lib/clang/17/lib/linux/"
278-
compiler_rt_lib = compiler_rt_dir / f"libclang_rt.builtins-{compiler_rt_arch}.a"
279-
out_path = cxx_package_libs / f"libclang_rt.builtins.float128-{compiler_rt_arch}.a"
280-
self._armerge_soft_float128_compiler_rt_builtins(compiler_rt_lib, out_path, env)
282+
compiler_rt_dir = android_bin_path / "../lib/clang/17/lib/linux/"
283+
compiler_rt_lib = (
284+
compiler_rt_dir / f"libclang_rt.builtins-{compiler_rt_arch}.a"
285+
)
286+
out_path = (
287+
cxx_package_libs
288+
/ f"libclang_rt.builtins.float128-{compiler_rt_arch}.a"
289+
)
290+
self._armerge_soft_float128_compiler_rt_builtins(
291+
compiler_rt_lib, out_path, env
292+
)
281293

282294
for lib in android_lib_path.glob("*.a"):
283295
# Rust already links some (non-C++) NDK libs, skip to avoid duplicate symbols
@@ -374,10 +386,10 @@ def _prepare_profile(self) -> None:
374386
shutil.copyfile(native_path / "ctanker.rs", mingw_path / "ctanker.rs")
375387

376388
def prepare(
377-
self,
378-
update: bool,
379-
tanker_source: TankerSource,
380-
tanker_ref: Optional[str] = None,
389+
self,
390+
update: bool,
391+
tanker_source: TankerSource,
392+
tanker_ref: Optional[str] = None,
381393
) -> None:
382394
tanker_deployed_ref = tanker_ref
383395
if tanker_source == TankerSource.DEPLOYED and not tanker_ref:
@@ -469,11 +481,11 @@ def test(self) -> None:
469481

470482

471483
def prepare(
472-
tanker_source: TankerSource,
473-
*,
474-
profiles: List[Profile],
475-
update: bool = False,
476-
tanker_ref: Optional[str] = None,
484+
tanker_source: TankerSource,
485+
*,
486+
profiles: List[Profile],
487+
update: bool = False,
488+
tanker_ref: Optional[str] = None,
477489
) -> None:
478490
build_profile = tankerci.conan.get_build_profile()
479491
for host_profile in profiles:
@@ -484,9 +496,9 @@ def prepare(
484496

485497

486498
def build(
487-
*,
488-
profiles: List[Profile],
489-
test: bool = False,
499+
*,
500+
profiles: List[Profile],
501+
test: bool = False,
490502
) -> None:
491503
build_profile = tankerci.conan.get_build_profile()
492504
if os.environ.get("CI"):
@@ -591,7 +603,7 @@ def main() -> None:
591603
if args.command == "build":
592604
profiles = [Profile(p) for p in args.profiles]
593605
with tankerci.conan.ConanContextManager(
594-
[args.remote, "conancenter"], conan_home=user_home
606+
[args.remote, "conancenter"], conan_home=user_home
595607
):
596608
build(
597609
profiles=profiles,
@@ -601,7 +613,7 @@ def main() -> None:
601613
deploy(args)
602614
elif args.command == "prepare":
603615
with tankerci.conan.ConanContextManager(
604-
[args.remote, "conancenter"], conan_home=user_home
616+
[args.remote, "conancenter"], conan_home=user_home
605617
):
606618
profiles = [Profile(p) for p in args.profiles]
607619
prepare(

0 commit comments

Comments
 (0)