From a82586a83047660c8e5d2fe20526ebccd2b0587c Mon Sep 17 00:00:00 2001 From: Andrea Mondelli Date: Thu, 10 Jan 2019 10:33:13 -0500 Subject: [PATCH] scons: added support of default Python installation on MacOS Recent MacOS versions are distributed with python 2.7. This version of python is sufficient to compile and run gem5. This patch allows to use the default python instead of the version provided by third-party tools (e.g., brew) The default MacOS LLDB debugger is linked against the default python installation, which conflicts with Python framework provided by third-party package systems. This patch removes the need of gem5 to have multiple python installations on MacOS, if not explicitly installed. Change-Id: I98f24804149cb2e04ca432c66d2f57e0296af7b2 Reviewed-on: https://gem5-review.googlesource.com/c/15475 Reviewed-by: Nikos Nikoleris Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- SConstruct | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 2f573b0f4..0e9e57508 100755 --- a/SConstruct +++ b/SConstruct @@ -92,6 +92,7 @@ from os import mkdir, environ from os.path import abspath, basename, dirname, expanduser, normpath from os.path import exists, isdir, isfile from os.path import join as joinpath, split as splitpath +from re import match # SCons includes import SCons @@ -710,9 +711,11 @@ if main['USE_PYTHON']: exception='').strip() py_includes = readCommand([python_config, '--includes'], exception='').split() + py_includes = filter(lambda s: match(r'.*\/include\/.*',s), py_includes) # Strip the -I from the include folders before adding them to the # CPPPATH - main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes)) + py_includes = map(lambda s: s[2:] if s.startswith('-I') else s, py_includes) + main.Append(CPPPATH=py_includes) # Read the linker flags and split them into libraries and other link # flags. The libraries are added later through the call the CheckLib. -- 2.30.2