Hello Andrea Mondelli,

I'd like you to do a code review. Please visit

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

to review the following change.


Change subject: scons: added support of default Python installation on MacOS
......................................................................

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: I9533c0f7858b5b3cab0ef101be1ee5cd718105b0
---
M SConstruct
M ext/mcpat/regression/regression.py
M ext/mcpat/regression/verify_output.py
M ext/ply/example/classcalc/calc.py
M ext/ply/example/newclasscalc/calc.py
M src/systemc/tests/verify.py
M src/unittest/genini.py
M tests/main.py
M tests/testing/__init__.py
M tests/testing/helpers.py
M tests/testing/results.py
M tests/testing/tests.py
M tests/testing/units.py
M tests/tests.py
M util/batch/job.py
M util/batch/send.py
M util/checkpoint-tester.py
M util/compile
M util/cpt_upgrader.py
M util/decode_inst_dep_trace.py
M util/decode_inst_trace.py
M util/decode_packet_trace.py
M util/encode_inst_dep_trace.py
M util/encode_packet_trace.py
M util/find_copyrights.py
M util/gen_arm_fs_files.py
M util/git-pre-commit.py
M util/hgstyle.py
M util/maint/list_changes.py
M util/maint/show_changes_by_file.py
M util/memtest-soak.py
M util/minorview.py
M util/o3-pipeview.py
M util/oprofile-top.py
M util/pbs/job.py
M util/pbs/send.py
M util/plot_dram/dram_lat_mem_rd_plot.py
M util/plot_dram/dram_sweep_plot.py
M util/protolib.py
M util/qdo
M util/regress
M util/slicc
M util/stats/stats.py
M util/streamline/m5stats2streamline.py
M util/style.py
M util/style/__init__.py
M util/style/repo.py
M util/style/sort_includes.py
M util/style/style.py
M util/style/verifiers.py
50 files changed, 57 insertions(+), 50 deletions(-)



diff --git a/SConstruct b/SConstruct
index 0a8cd0e..f15caa5 100755
--- a/SConstruct
+++ b/SConstruct
@@ -712,7 +712,14 @@
                               exception='').split()
     # Strip the -I from the include folders before adding them to the
     # CPPPATH
-    main.Append(CPPPATH=map(lambda inc: inc[2:], py_includes))
+    if (
+        sys.platform == "darwin" and
+        len(filter (lambda x : x == '-iwithsysroot', py_includes)) > 0
+        ) :
+        # Default MacOS Python
+        main.Append(CPPPATH=py_includes)
+    else:
+        main.Append(CPPPATH=map(lambda inc: inc[2:], 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.
diff --git a/ext/mcpat/regression/regression.py b/ext/mcpat/regression/regression.py
index 0115a56..ddfa81b 100755
--- a/ext/mcpat/regression/regression.py
+++ b/ext/mcpat/regression/regression.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
 # All rights reserved.
diff --git a/ext/mcpat/regression/verify_output.py b/ext/mcpat/regression/verify_output.py
index aaa7592..83e3e89 100644
--- a/ext/mcpat/regression/verify_output.py
+++ b/ext/mcpat/regression/verify_output.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
 # All rights reserved.
diff --git a/ext/ply/example/classcalc/calc.py b/ext/ply/example/classcalc/calc.py
index f359197..b0712fc 100755
--- a/ext/ply/example/classcalc/calc.py
+++ b/ext/ply/example/classcalc/calc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

# -----------------------------------------------------------------------------
 # calc.py
diff --git a/ext/ply/example/newclasscalc/calc.py b/ext/ply/example/newclasscalc/calc.py
index 3461f24..5a8db84 100755
--- a/ext/ply/example/newclasscalc/calc.py
+++ b/ext/ply/example/newclasscalc/calc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

# -----------------------------------------------------------------------------
 # calc.py
diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index def0fdc..503c11d 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright 2018 Google, Inc.
 #
diff --git a/src/unittest/genini.py b/src/unittest/genini.py
index 5a4f345..f10ad68 100755
--- a/src/unittest/genini.py
+++ b/src/unittest/genini.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2005 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/tests/main.py b/tests/main.py
index c8dc9b9..509724e 100755
--- a/tests/main.py
+++ b/tests/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 '''
 The main source for testlib. Ties together the default test runners and
 loaders.
diff --git a/tests/testing/__init__.py b/tests/testing/__init__.py
index 1bc4711..4230079 100644
--- a/tests/testing/__init__.py
+++ b/tests/testing/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/tests/testing/helpers.py b/tests/testing/helpers.py
index 29c6bf5..70e6dfb 100755
--- a/tests/testing/helpers.py
+++ b/tests/testing/helpers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/tests/testing/results.py b/tests/testing/results.py
index 4e07078..8cb3811 100644
--- a/tests/testing/results.py
+++ b/tests/testing/results.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/tests/testing/tests.py b/tests/testing/tests.py
index 123d3b1..00f3e5a 100755
--- a/tests/testing/tests.py
+++ b/tests/testing/tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016-2017 ARM Limited
 # All rights reserved
diff --git a/tests/testing/units.py b/tests/testing/units.py
index 220cf61..90918ae 100644
--- a/tests/testing/units.py
+++ b/tests/testing/units.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/tests/tests.py b/tests/tests.py
index a57a972..9967669 100755
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/util/batch/job.py b/util/batch/job.py
index 471b882..02e1fdc 100755
--- a/util/batch/job.py
+++ b/util/batch/job.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2006 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/batch/send.py b/util/batch/send.py
index 44a4f28..7707a0e 100755
--- a/util/batch/send.py
+++ b/util/batch/send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2006 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/checkpoint-tester.py b/util/checkpoint-tester.py
index bec4709..e7bd45e 100755
--- a/util/checkpoint-tester.py
+++ b/util/checkpoint-tester.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7

 # Copyright (c) 2010 Advanced Micro Devices, Inc.
 # All rights reserved.
diff --git a/util/compile b/util/compile
index f3040f7..a069f55 100755
--- a/util/compile
+++ b/util/compile
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2006 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/cpt_upgrader.py b/util/cpt_upgrader.py
index 59a4689..29a3413 100755
--- a/util/cpt_upgrader.py
+++ b/util/cpt_upgrader.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2012-2013,2015-2016 ARM Limited
 # All rights reserved
diff --git a/util/decode_inst_dep_trace.py b/util/decode_inst_dep_trace.py
index 956a161..5e89001 100755
--- a/util/decode_inst_dep_trace.py
+++ b/util/decode_inst_dep_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2013 - 2015 ARM Limited
 # All rights reserved
diff --git a/util/decode_inst_trace.py b/util/decode_inst_trace.py
index ff5c733..d8299b0 100755
--- a/util/decode_inst_trace.py
+++ b/util/decode_inst_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2013-2014 ARM Limited
 # All rights reserved
diff --git a/util/decode_packet_trace.py b/util/decode_packet_trace.py
index 9ef9b5f..6a4b386 100755
--- a/util/decode_packet_trace.py
+++ b/util/decode_packet_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2013-2014 ARM Limited
 # All rights reserved
diff --git a/util/encode_inst_dep_trace.py b/util/encode_inst_dep_trace.py
index d8d5ba1..ba8ca91 100755
--- a/util/encode_inst_dep_trace.py
+++ b/util/encode_inst_dep_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2015 ARM Limited
 # All rights reserved
diff --git a/util/encode_packet_trace.py b/util/encode_packet_trace.py
index c4d4616..0480714 100755
--- a/util/encode_packet_trace.py
+++ b/util/encode_packet_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2013-2014 ARM Limited
 # All rights reserved
diff --git a/util/find_copyrights.py b/util/find_copyrights.py
index 8a12bc3..39ac191 100644
--- a/util/find_copyrights.py
+++ b/util/find_copyrights.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 import os
 import re
diff --git a/util/gen_arm_fs_files.py b/util/gen_arm_fs_files.py
index bb8449a..45c36ee 100755
--- a/util/gen_arm_fs_files.py
+++ b/util/gen_arm_fs_files.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2017-2018 Metempsy Technology Consulting
 # All rights reserved.
diff --git a/util/git-pre-commit.py b/util/git-pre-commit.py
index 1b93069..db515f5 100755
--- a/util/git-pre-commit.py
+++ b/util/git-pre-commit.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/util/hgstyle.py b/util/hgstyle.py
index da0cdeb..9e199b7 100755
--- a/util/hgstyle.py
+++ b/util/hgstyle.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7
 # Copyright (c) 2014 ARM Limited
 # All rights reserved
 #
diff --git a/util/maint/list_changes.py b/util/maint/list_changes.py
index 3d9be8d..c27aab1 100755
--- a/util/maint/list_changes.py
+++ b/util/maint/list_changes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2017-2018 Arm Limited
 # All rights reserved
diff --git a/util/maint/show_changes_by_file.py b/util/maint/show_changes_by_file.py
index f4f9a96..cc863ce 100755
--- a/util/maint/show_changes_by_file.py
+++ b/util/maint/show_changes_by_file.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2018 Advanced Micro Devices, Inc.
 # All rights reserved.
diff --git a/util/memtest-soak.py b/util/memtest-soak.py
index b61d1c5..3913b0d 100755
--- a/util/memtest-soak.py
+++ b/util/memtest-soak.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7

 # Copyright (c) 2015 ARM Limited
 # All rights reserved
diff --git a/util/minorview.py b/util/minorview.py
index 39c6331..87f9c72 100755
--- a/util/minorview.py
+++ b/util/minorview.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2013 ARM Limited
 # All rights reserved
diff --git a/util/o3-pipeview.py b/util/o3-pipeview.py
index 08fd8d3..fedafd4 100755
--- a/util/o3-pipeview.py
+++ b/util/o3-pipeview.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7

 # Copyright (c) 2011 ARM Limited
 # All rights reserved
diff --git a/util/oprofile-top.py b/util/oprofile-top.py
index f644406..b678dd6 100755
--- a/util/oprofile-top.py
+++ b/util/oprofile-top.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7

 # Copyright (c) 2005 The Regents of The University of Michigan
 # All rights reserved.
diff --git a/util/pbs/job.py b/util/pbs/job.py
index 4c40031..8247218 100755
--- a/util/pbs/job.py
+++ b/util/pbs/job.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2005 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/pbs/send.py b/util/pbs/send.py
index 62ab2e5..d513650 100755
--- a/util/pbs/send.py
+++ b/util/pbs/send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2005 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/plot_dram/dram_lat_mem_rd_plot.py b/util/plot_dram/dram_lat_mem_rd_plot.py
index 422b140..bdfc3b4 100755
--- a/util/plot_dram/dram_lat_mem_rd_plot.py
+++ b/util/plot_dram/dram_lat_mem_rd_plot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2015 ARM Limited
 # All rights reserved
diff --git a/util/plot_dram/dram_sweep_plot.py b/util/plot_dram/dram_sweep_plot.py
index 5eb18b9..3cef209 100755
--- a/util/plot_dram/dram_sweep_plot.py
+++ b/util/plot_dram/dram_sweep_plot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2014 ARM Limited
 # All rights reserved
diff --git a/util/protolib.py b/util/protolib.py
index 1e442f1..5010483 100644
--- a/util/protolib.py
+++ b/util/protolib.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2013 ARM Limited
 # All rights reserved
diff --git a/util/qdo b/util/qdo
index 9ec9b8f..8008a40 100755
--- a/util/qdo
+++ b/util/qdo
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7

 # Copyright (c) 2004-2005, 2007 The Regents of The University of Michigan
 # All rights reserved.
diff --git a/util/regress b/util/regress
index da71e65..873d9cc 100755
--- a/util/regress
+++ b/util/regress
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7
 # Copyright (c) 2005-2007 The Regents of The University of Michigan
 # All rights reserved.
 #
diff --git a/util/slicc b/util/slicc
index b4ccec0..e8408f1 100755
--- a/util/slicc
+++ b/util/slicc
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 # Copyright (c) 2009 The Hewlett-Packard Development Company
 # All rights reserved.
 #
diff --git a/util/stats/stats.py b/util/stats/stats.py
index 209108c..6650f0e 100755
--- a/util/stats/stats.py
+++ b/util/stats/stats.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2003-2004 The Regents of The University of Michigan
 # All rights reserved.
diff --git a/util/streamline/m5stats2streamline.py b/util/streamline/m5stats2streamline.py
index 816d042..98aa1a8 100755
--- a/util/streamline/m5stats2streamline.py
+++ b/util/streamline/m5stats2streamline.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7

 # Copyright (c) 2012, 2014 ARM Limited
 # All rights reserved
diff --git a/util/style.py b/util/style.py
index 1dd7af3..44e53fd 100755
--- a/util/style.py
+++ b/util/style.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/util/style/__init__.py b/util/style/__init__.py
index 1bc4711..4230079 100644
--- a/util/style/__init__.py
+++ b/util/style/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/util/style/repo.py b/util/style/repo.py
index 7e3b444..d344405 100644
--- a/util/style/repo.py
+++ b/util/style/repo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2016 ARM Limited
 # All rights reserved
diff --git a/util/style/sort_includes.py b/util/style/sort_includes.py
index 39b3a13..1838925 100644
--- a/util/style/sort_includes.py
+++ b/util/style/sort_includes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2014-2015 ARM Limited
 # All rights reserved
diff --git a/util/style/style.py b/util/style/style.py
index 0f58590..1e35a7b 100644
--- a/util/style/style.py
+++ b/util/style/style.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2
+#! /usr/bin/env python2.7
 # Copyright (c) 2014, 2016 ARM Limited
 # All rights reserved
 #
diff --git a/util/style/verifiers.py b/util/style/verifiers.py
index 89247dc..33b127a 100644
--- a/util/style/verifiers.py
+++ b/util/style/verifiers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python2.7
 #
 # Copyright (c) 2014, 2016 ARM Limited
 # All rights reserved

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15375
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: I9533c0f7858b5b3cab0ef101be1ee5cd718105b0
Gerrit-Change-Number: 15375
Gerrit-PatchSet: 1
Gerrit-Owner: Andrea Mondelli <[email protected]>
Gerrit-Reviewer: Andrea Mondelli <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to