summaryrefslogtreecommitdiff
path: root/site_scons/site_tools/git.py
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh.poyarekar@gmail.com>2018-02-15 00:08:38 +0530
committerSiddhesh Poyarekar <siddhesh.poyarekar@gmail.com>2018-03-06 19:45:34 +0000
commit5c3983215a2bd27545e8500baddc0567c26783bf (patch)
tree15de535f4851605e910fc053634a59c3bbc40100 /site_scons/site_tools/git.py
parent93f57da4c48913552f984ccfe4b1318782a0e64a (diff)
downloadgem5-5c3983215a2bd27545e8500baddc0567c26783bf.tar.xz
scons: Import print_function from future
Scons on Fedora 27 imports print_function from the future[1] as a result of which a gem5 build errors out with a syntax error. Make all the scons scripts that use the print statement import the print_function from future and replace the statements with print function calls. [1] https://github.com/SCons/scons/commit/34cf3bdb1743de9a5534bfd25998d0a01297f004 Change-Id: I67b7ef978fd7567f94d3cd9a904f8a0c1af07ffb Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> Reviewed-on: https://gem5-review.googlesource.com/8321 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'site_scons/site_tools/git.py')
-rw-r--r--site_scons/site_tools/git.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/site_scons/site_tools/git.py b/site_scons/site_tools/git.py
index d9f8ab89f..1b40f28ef 100644
--- a/site_scons/site_tools/git.py
+++ b/site_scons/site_tools/git.py
@@ -38,6 +38,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import os
import gem5_scons.util
@@ -54,7 +55,7 @@ def install_style_hooks(env):
gitdir = env.Dir(readCommand(
["git", "rev-parse", "--git-dir"]).strip("\n"))
except Exception, e:
- print "Warning: Failed to find git repo directory: %s" % e
+ print("Warning: Failed to find git repo directory: %s" % e)
return
git_hooks = gitdir.Dir("hooks")
@@ -65,11 +66,12 @@ def install_style_hooks(env):
def hook_install(hook_name, script):
hook = git_hooks.File(hook_name)
if hook.exists():
- print "Warning: Can't install %s, hook already exists." % hook_name
+ print("Warning: Can't install %s, hook already exists." %
+ hook_name)
return
if hook.islink():
- print "Warning: Removing broken symlink for hook %s." % hook_name
+ print("Warning: Removing broken symlink for hook %s." % hook_name)
os.unlink(hook.get_abspath())
if not git_hooks.exists():
@@ -91,17 +93,17 @@ def install_style_hooks(env):
try:
os.symlink(script_path, hook.get_abspath())
except:
- print "Error updating git %s hook" % hook_name
+ print("Error updating git %s hook" % hook_name)
raise
if hook_exists("pre-commit") and hook_exists("commit-msg"):
return
- print git_style_message,
+ print(git_style_message, end=' ')
try:
raw_input()
except:
- print "Input exception, exiting scons.\n"
+ print("Input exception, exiting scons.\n")
sys.exit(1)
git_style_script = env.root.Dir("util").File("git-pre-commit.py")