From ed850fd263bdea1b2461a8cf0c39a12c6c419784 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 | 7 ++++--- setupsrc/pypdfium2_setup/packaging_base.py | 9 ++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 864b1f6a7..f41196b57 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,7 +143,7 @@ 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: prepare_setup(pl_name, pdfium_ver, use_v8) diff --git a/setupsrc/pypdfium2_setup/packaging_base.py b/setupsrc/pypdfium2_setup/packaging_base.py index ac53d111e..b042f780a 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? @@ -554,16 +554,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