summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2016-04-18 10:40:50 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2016-04-18 10:40:50 +0100
commit68a7752d733c09c6debfd9301517a7b5c913152f (patch)
treed852e735f8cec65d5ee2579a389b8bca0c6c5074 /SConstruct
parentf81951815877874b212b1963e76af3596855c337 (diff)
downloadgem5-68a7752d733c09c6debfd9301517a7b5c913152f.tar.xz
scons: Fix Python 2.6 compatibility
Don't use Python 2.7-style with statements in the SConstruct file.
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct36
1 files changed, 17 insertions, 19 deletions
diff --git a/SConstruct b/SConstruct
index 7bfdf5e25..9f277d2a9 100755
--- a/SConstruct
+++ b/SConstruct
@@ -332,25 +332,23 @@ if not ignore_style and hgdir.exists():
shutil.copyfile(hgrc.abspath, hgrc_old.abspath)
re_style_hook = re.compile(r"^([^=#]+)\.style\s*=\s*([^#\s]+).*")
re_style_extension = re.compile("style\s*=\s*([^#\s]+).*")
- with open(hgrc_old.abspath, 'r') as old, \
- open(hgrc.abspath, 'w') as new:
-
- for l in old:
- m_hook = re_style_hook.match(l)
- m_ext = re_style_extension.match(l)
- if m_hook:
- hook, check = m_hook.groups()
- if check != "python:style.check_style":
- print "Warning: %s.style is using a non-default " \
- "checker: %s" % (hook, check)
- if hook not in ("pretxncommit", "pre-qrefresh"):
- print "Warning: Updating unknown style hook: %s" % hook
-
- l = "%s.style = python:hgstyle.check_style\n" % hook
- elif m_ext and m_ext.group(1) == style_extension:
- l = "hgstyle = %s/util/hgstyle.py\n" % main.root.abspath
-
- new.write(l)
+ old, new = open(hgrc_old.abspath, 'r'), open(hgrc.abspath, 'w')
+ for l in old:
+ m_hook = re_style_hook.match(l)
+ m_ext = re_style_extension.match(l)
+ if m_hook:
+ hook, check = m_hook.groups()
+ if check != "python:style.check_style":
+ print "Warning: %s.style is using a non-default " \
+ "checker: %s" % (hook, check)
+ if hook not in ("pretxncommit", "pre-qrefresh"):
+ print "Warning: Updating unknown style hook: %s" % hook
+
+ l = "%s.style = python:hgstyle.check_style\n" % hook
+ elif m_ext and m_ext.group(1) == style_extension:
+ l = "hgstyle = %s/util/hgstyle.py\n" % main.root.abspath
+
+ new.write(l)
elif not style_hook:
print mercurial_style_message,
# continue unless user does ctrl-c/ctrl-d etc.