diff --git a/setupsrc/pypdfium2_setup/autorelease.py b/setupsrc/pypdfium2_setup/autorelease.py index 21425f957..b603e103d 100644 --- a/setupsrc/pypdfium2_setup/autorelease.py +++ b/setupsrc/pypdfium2_setup/autorelease.py @@ -12,6 +12,7 @@ sys.path.insert(0, str(Path(__file__).parents[1])) from pypdfium2_setup import update_pdfium +# TODO? consider glob import or dotted access from pypdfium2_setup.packaging_base import ( run_cmd, set_versions, @@ -37,7 +38,7 @@ RefBindingsFile = SourceTree / "bindings" / BindingsFileName # these files/dirs do not necessarily need to have been changed, `git add` silently skips that -PlacesToRegister = [AutoreleaseDir, VersionFile, Changelog, ChangelogStaging, RefBindingsFile] +PlacesToRegister = (AutoreleaseDir, VersionFile, Changelog, ChangelogStaging, RefBindingsFile) def run_local(*args, **kws): diff --git a/setupsrc/pypdfium2_setup/build_pdfium.py b/setupsrc/pypdfium2_setup/build_pdfium.py index 368e99d51..19de957b5 100755 --- a/setupsrc/pypdfium2_setup/build_pdfium.py +++ b/setupsrc/pypdfium2_setup/build_pdfium.py @@ -12,6 +12,7 @@ from pathlib import Path, WindowsPath sys.path.insert(0, str(Path(__file__).parents[1])) +# TODO? consider glob import or dotted access from pypdfium2_setup.packaging_base import ( Host, SB_Dir, @@ -139,11 +140,7 @@ def get_pdfium_version(): tag = ref.split("/")[-1] print(f"Current head {head_commit}, latest tagged commit {tag_commit} ({tag})", file=sys.stderr) - - if head_commit == tag_commit: - v_libpdfium = tag - else: - v_libpdfium = head_commit + v_libpdfium = tag if head_commit == tag_commit else head_commit return v_libpdfium diff --git a/setupsrc/pypdfium2_setup/craft_packages.py b/setupsrc/pypdfium2_setup/craft_packages.py index dfc0479ad..9b18b88c6 100644 --- a/setupsrc/pypdfium2_setup/craft_packages.py +++ b/setupsrc/pypdfium2_setup/craft_packages.py @@ -9,6 +9,7 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).parents[1])) +# TODO? consider glob import or dotted access from pypdfium2_setup.packaging_base import ( run_cmd, clean_platfiles, diff --git a/setupsrc/pypdfium2_setup/packaging_base.py b/setupsrc/pypdfium2_setup/packaging_base.py index 08c371a2a..091a87a2d 100644 --- a/setupsrc/pypdfium2_setup/packaging_base.py +++ b/setupsrc/pypdfium2_setup/packaging_base.py @@ -96,7 +96,7 @@ class PlatformNames: def plat_to_system(pl_name): if pl_name == PlatformNames.sourcebuild: - # FIXME If doing a sourcebuild on an unknown host system, this returns None, which will cause binary detection code to fail (we need to know the platform-specific binary name) - handle this upstream with fallback value? + # FIXME If doing a sourcebuild on an unknown host system, this returns None, which will cause binary detection code to fail (we need to know the platform-specific binary name) - handle this downsteam with fallback value? return Host.system result = [s for s in BinarySystems if pl_name.startswith(s)] assert len(result) == 1 @@ -171,6 +171,7 @@ def get_wheel_tag(pl_name): return "macosx_11_0_arm64" # As of May 2023, pdfium may potentially require glibc >= 2.26, but the actual requirement is still lower in practice # (see https://crrev.com/1084974 and https://groups.google.com/a/chromium.org/g/chromium-dev/c/SdCs9k3celo/m/bnnBzU1FCgAJ) + # TODO? consider calling objdump to dynamically determine glibc requirement elif pl_name == PlatformNames.linux_x64: return "manylinux_2_26_x86_64" elif pl_name == PlatformNames.linux_x86: diff --git a/setupsrc/pypdfium2_setup/setup_base.py b/setupsrc/pypdfium2_setup/setup_base.py index fb1bc9577..b5494d83d 100644 --- a/setupsrc/pypdfium2_setup/setup_base.py +++ b/setupsrc/pypdfium2_setup/setup_base.py @@ -7,6 +7,7 @@ from wheel.bdist_wheel import bdist_wheel sys.path.insert(0, str(Path(__file__).parents[1])) +# TODO? consider glob import or dotted access from pypdfium2_setup.packaging_base import ( VerNamespace, LibnameForSystem, diff --git a/setupsrc/pypdfium2_setup/update_pdfium.py b/setupsrc/pypdfium2_setup/update_pdfium.py index a0639ef20..af8c08b98 100755 --- a/setupsrc/pypdfium2_setup/update_pdfium.py +++ b/setupsrc/pypdfium2_setup/update_pdfium.py @@ -14,6 +14,7 @@ from concurrent.futures import ThreadPoolExecutor sys.path.insert(0, str(Path(__file__).parents[1])) +# TODO? consider glob import or dotted access from pypdfium2_setup.packaging_base import ( Host, DataTree, @@ -80,7 +81,6 @@ def download_releases(version, platforms, robust, max_workers, use_v8): return archives - def safe_extract(tar, dest_dir, **kwargs): # Workaround against CVE-2007-4559 (path traversal attack) (thanks @Kasimir123 / @TrellixVulnTeam) @@ -124,7 +124,7 @@ def generate_bindings(archives, version): items = list(bin_dir.iterdir()) assert len(items) == 1 - shutil.move(bin_dir / items[0], pl_dir / target_name) + shutil.move(bin_dir/items[0], pl_dir/target_name) ver_file = DataTree / pl_name / VerStatusFileName ver_file.write_text(str(version))