[gem5-dev] Change in gem5/gem5[master]: scons: Add support for specifying Python version

2019-02-23 Thread Andreas Sandberg (Gerrit)
Andreas Sandberg has submitted this change and it was merged. (  
https://gem5-review.googlesource.com/c/public/gem5/+/16003 )


Change subject: scons: Add support for specifying Python version
..

scons: Add support for specifying Python version

Add a sticky variable (PYTHON_CONFIG) to select which python-config
version to use. This can, for example, be used to build with Python 3
or with Python 2.7 in a custom location.

Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Signed-off-by: Andreas Sandberg 
Reviewed-on: https://gem5-review.googlesource.com/c/16003
Reviewed-by: Gabe Black 
---
M SConstruct
1 file changed, 23 insertions(+), 7 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved



diff --git a/SConstruct b/SConstruct
index 5162c3d..3599371 100755
--- a/SConstruct
+++ b/SConstruct
@@ -215,6 +215,19 @@
 return [abspath(joinpath(root, expanduser(str(p
 for p in path_list]

+def find_first_prog(prog_names):
+"""Find the absolute path to the first existing binary in prog_names"""
+
+if not isinstance(prog_names, (list, tuple)):
+prog_names = [ prog_names ]
+
+for p in prog_names:
+p = main.WhereIs(p)
+if p is not None:
+return p
+
+return None
+
 # Each target must have 'build' in the interior of the path; the
 # directory below this will determine the build parameters.  For
 # example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
@@ -276,6 +289,8 @@
 global_vars.AddVariables(
 ('CC', 'C compiler', environ.get('CC', main['CC'])),
 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
+('PYTHON_CONFIG', 'Python config binary to use',
+ [ 'python2.7-config', 'python-config' ]),
 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
 ('BATCH', 'Use batch pool for build and tests', False),
 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
@@ -702,13 +717,14 @@
 # we add them explicitly below. If you want to link in an alternate
 # version of python, see above for instructions on how to invoke
 # scons with the appropriate PATH set.
-#
-# First we check if python2-config exists, else we use python-config
-python_config = readCommand(['which', 'python2-config'],
-exception='').strip()
-if not os.path.exists(python_config):
-python_config = readCommand(['which', 'python-config'],
-exception='').strip()
+
+python_config = find_first_prog(main['PYTHON_CONFIG'])
+if python_config is None:
+print("Error: can't find a suitable python-config, tried %s" % \
+  main['PYTHON_CONFIG'])
+Exit(1)
+
+print("Info: Using Python config: %s" % (python_config, ))
 py_includes = readCommand([python_config, '--includes'],
   exception='').split()
 py_includes = filter(lambda s: match(r'.*\/include\/.*',s),  
py_includes)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16003
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Gerrit-Change-Number: 16003
Gerrit-PatchSet: 11
Gerrit-Owner: Andreas Sandberg 
Gerrit-Assignee: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Juha Jäykkä 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: scons: Add support for specifying Python version

2019-02-22 Thread Andreas Sandberg (Gerrit)
Hello Gabe Black, Jason Lowe-Power, Juha Jäykkä, Giacomo Travaglini, Ciro  
Santilli,


I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/c/public/gem5/+/16003

to look at the new patch set (#8).

Change subject: scons: Add support for specifying Python version
..

scons: Add support for specifying Python version

Add a sticky variable (PYTHON_CONFIG) to select which python-config
version to use. This can, for example, be used to build with Python 3
or with Python 2.7 in a custom location.

Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Signed-off-by: Andreas Sandberg 
---
M SConstruct
1 file changed, 23 insertions(+), 7 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16003
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Gerrit-Change-Number: 16003
Gerrit-PatchSet: 8
Gerrit-Owner: Andreas Sandberg 
Gerrit-Assignee: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Juha Jäykkä 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: scons: Add support for specifying Python version

2019-02-21 Thread Andreas Sandberg (Gerrit)
Hello Gabe Black, Jason Lowe-Power, Juha Jäykkä, Giacomo Travaglini, Ciro  
Santilli,


I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/c/public/gem5/+/16003

to look at the new patch set (#7).

Change subject: scons: Add support for specifying Python version
..

scons: Add support for specifying Python version

Add a sticky variable (PYTHON_CONFIG) to select which python-config
version to use. This can, for example, be used to build with Python 3
or with Python 2.7 in a custom location.

Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Signed-off-by: Andreas Sandberg 
---
M SConstruct
1 file changed, 23 insertions(+), 7 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16003
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Gerrit-Change-Number: 16003
Gerrit-PatchSet: 7
Gerrit-Owner: Andreas Sandberg 
Gerrit-Assignee: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Juha Jäykkä 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: scons: Add support for specifying Python version

2019-02-13 Thread Andreas Sandberg (Gerrit)
Hello Gabe Black, Jason Lowe-Power, Juha Jäykkä, Giacomo Travaglini, Ciro  
Santilli,


I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/c/public/gem5/+/16003

to look at the new patch set (#6).

Change subject: scons: Add support for specifying Python version
..

scons: Add support for specifying Python version

Add a sticky variable (PYTHON_CONFIG) to select which python-config
version to use. This can, for example, be used to build with Python 3
or with Python 2.7 in a custom location.

Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Signed-off-by: Andreas Sandberg 
---
M SConstruct
1 file changed, 24 insertions(+), 7 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16003
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1f4c00d66f85a9c99f50fe4d746b69dd82b60b4b
Gerrit-Change-Number: 16003
Gerrit-PatchSet: 6
Gerrit-Owner: Andreas Sandberg 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Juha Jäykkä 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev