From 1da3677de1f986fe4f8dd022634ae6112718d048 Mon Sep 17 00:00:00 2001 From: geisserml Date: Fri, 10 Nov 2023 19:02:39 +0100 Subject: [PATCH] Fix sdist package getting wrong name Should fix this release attempt failure. https://github.com/pypdfium2-team/pypdfium2/actions/runs/6827951737 It failed during testpypi upload because the sdist package erroneously got the name "pypdfium2_helpers": Unfortunately, release commit and tag had already been published. This has been undone by force push. --- setup.py | 9 +++++---- setupsrc/pypdfium2_setup/packaging_base.py | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 864b1f6a7..11e6b8e63 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,8 @@ def run_setup(modnames, pl_name, pdfium_ver): install_requires = [], ) - if modnames == [ModuleHelpers]: + if modnames == [ModuleHelpers] and pl_name != ExtPlats.none: + # do not do this for sdist (none) kwargs["name"] += "_helpers" kwargs["description"] += " (helpers module)" kwargs["install_requires"] += ["pypdfium2_raw"] @@ -112,7 +113,7 @@ def run_setup(modnames, pl_name, pdfium_ver): if ModuleRaw in modnames: kwargs["package_dir"]["pypdfium2_raw"] = "src/pypdfium2_raw" - if ModuleRaw not in modnames: + if ModuleRaw not in modnames or pl_name == ExtPlats.none: kwargs["exclude_package_data"] = {"pypdfium2_raw": PLATFILES_GLOB} if pl_name == ExtPlats.none: kwargs["license_files"] += LICENSES_SDIST @@ -142,9 +143,9 @@ def main(): # NOTE in principle, it may be possible to achieve the same as `prepared!` by just filling the data/ cache manually, but this is more explicit, formally disabling the generating code paths with_prepare, pl_name, pdfium_ver, use_v8 = parse_pl_spec(pl_spec) - modnames = parse_modspec(modspec, pl_name) + modnames = parse_modspec(modspec) - if ModuleRaw in modnames and with_prepare: + if ModuleRaw in modnames and with_prepare and pl_name != ExtPlats.none: prepare_setup(pl_name, pdfium_ver, use_v8) run_setup(modnames, pl_name, pdfium_ver) diff --git a/setupsrc/pypdfium2_setup/packaging_base.py b/setupsrc/pypdfium2_setup/packaging_base.py index ac53d111e..dfd5b4f6c 100644 --- a/setupsrc/pypdfium2_setup/packaging_base.py +++ b/setupsrc/pypdfium2_setup/packaging_base.py @@ -70,7 +70,7 @@ class SysNames: class ExtPlats: sourcebuild = "sourcebuild" system = "system" - none = "none" + none = "none" # FIXME rename to sdist? auto = "auto" # TODO align with either python or google platform names? @@ -234,6 +234,7 @@ def plat_to_system(pl_name): if pl_name == ExtPlats.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 downsteam with fallback value? return Host.system + # NOTE other ExtPlats not supported here return getattr(SysNames, pl_name.split("_", maxsplit=1)[0]) @@ -554,16 +555,11 @@ def parse_pl_spec(pl_spec, need_prepare=True): return need_prepare, pl_name, req_ver, use_v8 -def parse_modspec(modspec, pl_name): +def parse_modspec(modspec): if modspec: modnames = modspec.split(",") assert set(modnames).issubset(ModulesAll) assert len(modnames) in (1, 2) else: modnames = ModulesAll - - modnames = list(modnames) - if pl_name == ExtPlats.none and ModuleRaw in modnames: - modnames.remove(ModuleRaw) - return modnames