From a1ad2c77afbd6f47ed148d9507773f1c39361727 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Tue, 31 May 2022 10:15:06 -0600 Subject: [PATCH] MAINT: git security shim for 1.9.x * replicated gh-16139 on the latest maintenance branch because the `master` branch of the wheels repo will encounter the issues described in that PR (for example, see: https://github.com/MacPython/scipy-wheels/pull/166 which has Travis and Azure failures caused by those same versioning issues) * I think the `cwd` is still correct even though the patch is being applied to a different file this time (used to be `setup.py`), though we could double check this by pointing the wheels PR at the commit hash of this PR if we want * any reason not to forward port this as well at this point, if we're going to need to keep backporting it? --- tools/version_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/version_utils.py b/tools/version_utils.py index c5c5cbe77549..6365e89a2954 100644 --- a/tools/version_utils.py +++ b/tools/version_utils.py @@ -81,7 +81,9 @@ def _minimal_ext_cmd(cmd): return out try: - out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD']) + cwd = os.getcwd() + git_dir = os.path.join(cwd, ".git") + out = _minimal_ext_cmd(['git', '--git-dir', git_dir, 'rev-parse', 'HEAD']) GIT_REVISION = out.strip().decode('ascii')[:7] # We need a version number that's regularly incrementing for newer commits,