diff --git a/setup.py b/setup.py index 29216e3ef..b10ef0926 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ def run(self, *args, **kwargs): helpers_info["n_commits"] = math.inf helpers_info["hash"] = "editable" helpers_info["dirty"] = True - helpers_info["version"] = craft_helpers_id(helpers_info, mode="py") + helpers_info["version"] = merge_git_describe(helpers_info, mode="py") write_json(ModuleDir_Helpers/VersionFN, helpers_info) build_py_orig.run(self, *args, **kwargs) @@ -65,8 +65,8 @@ def main(): ver_file = ModuleDir_Helpers/VersionFN if HAVE_GIT_REPO: - helpers_info = read_helpers_ver() - helpers_info["version"] = craft_helpers_id(helpers_info, mode="py") + helpers_info = parse_git_describe() + helpers_info["version"] = merge_git_describe(helpers_info, mode="py") else: # sdist compat log("Warning: Local git repo not available, so we depend on an existing version file.") assert ver_file.exists(), f"{'/'.join(ver_file.parts[-2:])} does not exist." diff --git a/setupsrc/pypdfium2_setup/autorelease.py b/setupsrc/pypdfium2_setup/autorelease.py index edb4bb3bd..761701a5e 100644 --- a/setupsrc/pypdfium2_setup/autorelease.py +++ b/setupsrc/pypdfium2_setup/autorelease.py @@ -204,12 +204,12 @@ def main(): latest_pdfium = PdfiumVer.get_latest() increments = read_json(IncrementsFile, with_checksum=False) prev_pdfium = read_json(VerFile_Pdfium)["build"] - prev_helpers = read_helpers_ver() + prev_helpers = parse_git_describe() (c_updates, new_pdfium), (py_updates, new_helpers) = \ do_versioning(increments, prev_pdfium, prev_helpers, latest_pdfium) - prev_tag = craft_helpers_id(prev_helpers, mode=None) - new_tag = craft_helpers_id(new_helpers, mode=None) + prev_tag = merge_git_describe(prev_helpers, mode=None) + new_tag = merge_git_describe(new_helpers, mode=None) update_refbindings(latest_pdfium) summary = get_changelog_staging(new_helpers["beta"]) @@ -217,7 +217,7 @@ def main(): if args.register: register_changes(new_tag) # Verify the next version parses correctly and reading the record returns the info we wrote - assert read_helpers_ver() == new_helpers + assert parse_git_describe() == new_helpers make_releasenotes(summary, prev_pdfium, new_pdfium, prev_tag, new_tag, c_updates) diff --git a/setupsrc/pypdfium2_setup/packaging_base.py b/setupsrc/pypdfium2_setup/packaging_base.py index 8f87d6c9d..71faa22c2 100644 --- a/setupsrc/pypdfium2_setup/packaging_base.py +++ b/setupsrc/pypdfium2_setup/packaging_base.py @@ -188,7 +188,7 @@ def write_pdfium_info(dir, version, origin, flags=set()): write_json(dir/VersionFN, info) -def read_helpers_ver(): +def parse_git_describe(): info = dict() descriptor = run_cmd(["git", "describe", "--dirty"], capture=True, cwd=ProjectDir) @@ -210,12 +210,12 @@ def read_helpers_ver(): for value, (key, cast) in zip(id_parts, schema): info[key] = cast(value) - assert craft_helpers_id(info, mode="git") == descriptor + assert merge_git_describe(info, mode="git") == descriptor return info -def craft_helpers_id(info, mode): +def merge_git_describe(info, mode): tag = f"{info['major']}.{info['minor']}.{info['patch']}" if info['beta'] is not None: