Skip to content

Commit

Permalink
Minor setupsrc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed May 28, 2023
1 parent e4a1b0f commit 6132aa5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion setupsrc/pypdfium2_setup/autorelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down
7 changes: 2 additions & 5 deletions setupsrc/pypdfium2_setup/build_pdfium.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions setupsrc/pypdfium2_setup/craft_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion setupsrc/pypdfium2_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions setupsrc/pypdfium2_setup/setup_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions setupsrc/pypdfium2_setup/update_pdfium.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 6132aa5

Please sign in to comment.