summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew Robinson <mathew.robinson@mongodb.com>2020-01-16 23:04:43 +0000
committerA. Jesse Jiryu Davis <jesse@mongodb.com>2020-01-27 15:40:36 -0500
commit3859c6ac651df4a79a09637103279c38dfbc4d16 (patch)
treeb46bb6754e23ed9b383859f7267a04f712bc51d4
parent893126f80f2a43b9f5318e23d8878d85acdba87b (diff)
downloadmongo-3859c6ac651df4a79a09637103279c38dfbc4d16.tar.gz
SERVER-42702 $PYTHON should not be used in build signature
-rw-r--r--SConstruct2
-rw-r--r--buildscripts/utils.py27
-rwxr-xr-xsite_scons/site_tools/idl_tool.py2
3 files changed, 2 insertions, 29 deletions
diff --git a/SConstruct b/SConstruct
index ee22daf3fdf..f65a4add436 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1061,7 +1061,7 @@ envDict = dict(BUILD_ROOT=buildDir,
MODULE_INJECTORS=dict(),
ARCHIVE_ADDITION_DIR_MAP={},
ARCHIVE_ADDITIONS=[],
- PYTHON=utils.find_python(),
+ PYTHON="$( {} $)".format(sys.executable),
SERVER_ARCHIVE='${SERVER_DIST_BASENAME}${DIST_ARCHIVE_SUFFIX}',
UNITTEST_ALIAS='unittests',
# TODO: Move unittests.txt to $BUILD_DIR, but that requires
diff --git a/buildscripts/utils.py b/buildscripts/utils.py
index 4e2edcc76e5..8228675d084 100644
--- a/buildscripts/utils.py
+++ b/buildscripts/utils.py
@@ -130,33 +130,6 @@ def which(executable):
return executable
-def find_python(min_version=(3, 7)):
- """Return path of python."""
- try:
- return sys.executable
- except AttributeError:
- # In case the version of Python is somehow missing sys.version_info or sys.executable.
- pass
-
- version = re.compile(r"[Pp]ython ([\d\.]+)", re.MULTILINE)
- binaries = ("python37", "python3.7", "python36", "python3.6", "python35", "python3.5", "python")
- for binary in binaries:
- try:
- out, err = subprocess.Popen([binary, "-V"], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate()
- for stream in (out, err):
- match = version.search(stream)
- if match:
- versiontuple = tuple(map(int, match.group(1).split(".")))
- if versiontuple >= min_version:
- return which(binary)
- except Exception: # pylint: disable=broad-except
- pass
-
- raise Exception(
- "could not find suitable Python (version >= %s)" % ".".join(str(v) for v in min_version))
-
-
def replace_with_repr(unicode_error):
"""Codec error handler replacement."""
# Unicode is a pain, some strings cannot be unicode()'d
diff --git a/site_scons/site_tools/idl_tool.py b/site_scons/site_tools/idl_tool.py
index b041dc8cb7e..03b4254e417 100755
--- a/site_scons/site_tools/idl_tool.py
+++ b/site_scons/site_tools/idl_tool.py
@@ -94,7 +94,7 @@ def generate(env):
global idlc
idlc = idlc_mod
- env["IDLC"] = sys.executable + " buildscripts/idl/idlc.py"
+ env["IDLC"] = "$PYTHON buildscripts/idl/idlc.py"
env["IDLCFLAGS"] = ""
base_dir = env.subst("$BUILD_ROOT/$VARIANT_DIR").replace("#", "")
env["IDLCCOM"] = (