From a2ba356284d1d932135d395c36c315182886aa41 Mon Sep 17 00:00:00 2001 From: geisserml Date: Wed, 22 Nov 2023 23:30:13 +0100 Subject: [PATCH] require explicit build number --- setupsrc/pypdfium2_setup/autorelease_conda_raw.py | 2 +- setupsrc/pypdfium2_setup/craft_packages.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/setupsrc/pypdfium2_setup/autorelease_conda_raw.py b/setupsrc/pypdfium2_setup/autorelease_conda_raw.py index ab8d8b68a..d2da77666 100644 --- a/setupsrc/pypdfium2_setup/autorelease_conda_raw.py +++ b/setupsrc/pypdfium2_setup/autorelease_conda_raw.py @@ -25,7 +25,7 @@ def main(): search = reversed(json.loads(search)["pypdfium2_raw"]) # determine build number - # TODO `search` is ordered descendingly, so we could break the iteration when we find a matching version. though for a new version, we have to traverse the full list anyway... + # TODO `search` seems to be ordered by date, so we could probably break the iteration when we find a matching version. though for a new version, we have to traverse the full list anyway... build = max([d["build_number"] for d in search if int(d["version"]) == args.pdfium_ver], default=None) build = 0 if build is None else build+1 print(build, file=sys.stderr) diff --git a/setupsrc/pypdfium2_setup/craft_packages.py b/setupsrc/pypdfium2_setup/craft_packages.py index 04dc5c2ee..a02baffc0 100644 --- a/setupsrc/pypdfium2_setup/craft_packages.py +++ b/setupsrc/pypdfium2_setup/craft_packages.py @@ -168,9 +168,8 @@ def main_conda_bundle(args): def main_conda_raw(args): os.environ["PDFIUM_SHORT"] = str(args.pdfium_ver) os.environ["PDFIUM_FULL"] = ".".join([str(v) for v in PdfiumVer.to_full(args.pdfium_ver)]) - build_num = 0 - if CondaRaw_BuildNumF.exists(): - build_num = int(CondaRaw_BuildNumF.read_text().strip()) + assert CondaRaw_BuildNumF.exists(), "build number must be given explicitly through conda/raw/build_num.txt - run autorelease_conda_raw.py to create" + build_num = int(CondaRaw_BuildNumF.read_text().strip()) os.environ["BUILD_NUM"] = str(build_num) emplace_func = partial(prepare_setup, ExtPlats.system, args.pdfium_ver, use_v8=None) with CondaExtPlatfiles(emplace_func):