From b9da3cb2236df05834148bd756bf860e990f056a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Mon, 22 Mar 2021 01:51:54 +0000 Subject: [PATCH] Preserve SETUPTOOLS_SCM_PRETEND_VERSION. --- ognibuild/buildsystem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index 57c294d..e351d0b 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -352,10 +352,16 @@ class SetupPy(BuildSystem): install_missing_reqs(session, resolver, list(self._setup_requires())) interpreter = shebang_binary(os.path.join(self.path, 'setup.py')) if interpreter is not None: - run_with_build_fixers(session, ["./setup.py"] + args, fixers) + argv = ["./setup.py"] + args else: # Just assume it's Python 3 - run_with_build_fixers(session, [self.DEFAULT_PYTHON, "./setup.py"] + args, fixers) + argv = [self.DEFAULT_PYTHON, "./setup.py"] + args + env = {} + # Inherit SETUPTOOLS_SCM_PRETEND_VERSION from the current environment + if 'SETUPTOOLS_SCM_PRETEND_VERSION' in os.environ: + env['SETUPTOOLS_SCM_PRETEND_VERSION'] = ( + os.environ['SETUPTOOLS_SCM_PRETEND_VERSION']) + run_with_build_fixers(session, argv, fixers, env=env) def _setup_requires(self): if self.pyproject: