scons: Pull some python related mechanisms out of USE_PYTHON guards.

We don't want to build certain files if USE_PYTHON is disabled, but we
can still tell scons how to.

Change-Id: I38c7c93f609cfcedc350f8270f0b239b69c4f101
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48367
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-07-18 21:59:27 -07:00
parent e20e3cf47e
commit f4d8200178
2 changed files with 72 additions and 73 deletions

View File

@@ -516,12 +516,6 @@ if main['USE_PYTHON']:
if not py_version:
error("Can't find a working Python installation")
marshal_env = main.Clone()
# Bare minimum environment that only includes python
marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')
# Found a working Python installation. Check if it meets minimum
# requirements.
ver_string = '.'.join(map(str, py_version))
@@ -532,6 +526,12 @@ if main['USE_PYTHON']:
warning('Embedded python library too new. '
'Python 3 expected, found %s.' % ver_string)
marshal_env = main.Clone()
# Bare minimum environment that only includes python
marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')
main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
with gem5_scons.Configure(main) as conf:
@@ -704,9 +704,7 @@ Build variables for {dir}:
env.Append(CCFLAGS='$CCFLAGS_EXTRA')
env.Append(LINKFLAGS='$LDFLAGS_EXTRA')
exports=['env']
if main['USE_PYTHON']:
exports.append('marshal_env')
exports=['env', 'marshal_env']
# The src/SConscript file sets up the build rules in 'env' according
# to the configured variables. It returns a list of environments,