diff --git a/setup.py b/setup.py index d33339aca..bea7cfd3c 100644 --- a/setup.py +++ b/setup.py @@ -102,14 +102,15 @@ def run_setup(modnames, pl_name, pdfium_ver): if ModuleHelpers in modnames: helpers_info = get_helpers_info() - # ignore dirty state due to craft_packages::tmp_ctypesgen_pin() if pl_name == ExtPlats.sdist: if helpers_info["dirty"]: - status = run_cmd(["git", "status", "--porcelain"], capture=True, cwd=ProjectDir).strip() - if status == "M pyproject.toml": + # ignore dirty state due to craft_packages::tmp_ctypesgen_pin() + if int(os.environ.get("SDIST_IGNORE_DIRTY", 0)): + status = run_cmd(["git", "status", "--porcelain"], capture=True, cwd=ProjectDir).strip() + assert status == "M pyproject.toml" helpers_info["dirty"] = False else: - print("Warning: sdist built without ctypesgen pin?", file=sys.stderr) + print("!!! Warning: sdist built without ctypesgen pin?", file=sys.stderr) kwargs["version"] = merge_tag(helpers_info, mode="py") # is_editable = None: unknown/fallback in case the cmdclass is not reached helpers_info["is_editable"] = None diff --git a/setupsrc/pypdfium2_setup/craft_packages.py b/setupsrc/pypdfium2_setup/craft_packages.py index a1b6f2c72..8580cdf00 100644 --- a/setupsrc/pypdfium2_setup/craft_packages.py +++ b/setupsrc/pypdfium2_setup/craft_packages.py @@ -96,7 +96,10 @@ def main_pypi(args): if args.sdist: os.environ[PlatSpec_EnvVar] = ExtPlats.sdist + helpers_info = get_helpers_info() with tmp_ctypesgen_pin(): + if not helpers_info["dirty"]: + os.environ["SDIST_IGNORE_DIRTY"] = "1" _run_pypi_build(["--sdist"]) if args.wheels: