summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-26 15:31:00 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-26 15:31:00 +0000
commitec72a41af1343b96ccc1763f2cf6b07952585f4e (patch)
treeae53d6cf4616fac118eef13ca6078d2edad842a1 /contrib
parentd876ba6e4758bf7529cefae646977610e56a2a1c (diff)
downloadgcc-ec72a41af1343b96ccc1763f2cf6b07952585f4e.tar.gz
Do not use 'with ... as ...' in validate_failures.py
Some of the hosts were we run this script are still using Python 2.4. This patch replaces the use of 'with ... as ...' to avoid syntax errors. 2012-07-26 Diego Novillo <dnovillo@google.com> * testsuite-management/validate_failures.py: Do not use 'with ... as ...' constructs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189893 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog5
-rwxr-xr-xcontrib/testsuite-management/validate_failures.py32
2 files changed, 23 insertions, 14 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index ee68edba2e5..b1a1d5fe189 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-26 Diego Novillo <dnovillo@google.com>
+
+ * testsuite-management/validate_failures.py: Do not use
+ 'with ... as ...' constructs.
+
2012-07-19 Diego Novillo <dnovillo@google.com>
* testsuite-management/validate_failures.py (CollectSumFiles):
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index c48e4c3de70..ef01938f02e 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -138,12 +138,14 @@ class TestResult(object):
def GetMakefileValue(makefile_name, value_name):
if os.path.exists(makefile_name):
- with open(makefile_name) as makefile:
- for line in makefile:
- if line.startswith(value_name):
- (_, value) = line.split('=', 1)
- value = value.strip()
- return value
+ makefile = open(makefile_name)
+ for line in makefile:
+ if line.startswith(value_name):
+ (_, value) = line.split('=', 1)
+ value = value.strip()
+ makefile.close()
+ return value
+ makefile.close()
return None
@@ -173,10 +175,11 @@ def IsInterestingResult(line):
def ParseSummary(sum_fname):
"""Create a set of TestResult instances from the given summary file."""
result_set = set()
- with open(sum_fname) as sum_file:
- for line in sum_file:
- if IsInterestingResult(line):
- result_set.add(TestResult(line))
+ sum_file = open(sum_fname)
+ for line in sum_file:
+ if IsInterestingResult(line):
+ result_set.add(TestResult(line))
+ sum_file.close()
return result_set
@@ -317,10 +320,11 @@ def ProduceManifest(options):
sum_files = GetSumFiles(options.results, options.build_dir)
actual = GetResults(sum_files)
- with open(manifest_name, 'w') as manifest_file:
- for result in sorted(actual):
- print result
- manifest_file.write('%s\n' % result)
+ manifest_file = open(manifest_name, 'w')
+ for result in sorted(actual):
+ print result
+ manifest_file.write('%s\n' % result)
+ manifest_file.close()
return True