From be05a04c9eca068248ca6264eec531b6b4369bfd Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 26 Aug 2026 12:02:01 +0500 Subject: [PATCH] package-zip-archives: get hash using `git rev-parse` for local runs --- nix/package-zip-archives.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nix/package-zip-archives.py b/nix/package-zip-archives.py index e4d2e12bd3..67735bb1a5 100644 --- a/nix/package-zip-archives.py +++ b/nix/package-zip-archives.py @@ -27,6 +27,11 @@ REPO_ROOT = Path(run("git", "-C", str(Path(__file__).parent), "rev-parse", "--sh VERSION = "v" + (REPO_ROOT / "VERSION").read_text().strip() +def get_git_sha() -> str: + sha = os.getenv("GITHUB_SHA") or run("git", "rev-parse", "HEAD", cwd=REPO_ROOT).strip() + return sha[:7] + + def is_platform(name: Literal["MAC", "LINUX"]) -> bool: current = "MAC" if platform.system() == "Darwin" else "LINUX" return current == name @@ -318,7 +323,7 @@ def main() -> None: # Iterate over all built Python wrappers in `install/ifcopenshell/python-x.y.z` # and zip them, bundling all dynamic libs from `lib`. - github_sha = os.environ["GITHUB_SHA"][:7] + github_sha = get_git_sha() for py_dir in sorted(ifcopenshell_install_dir.glob("python-*")): package_python_wrapper(py_dir, ifcopenshell_install_dir, github_sha, output_dir, args.arch_suffix)