summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2012-07-26 11:31:00 -0400
committerDiego Novillo <dnovillo@gcc.gnu.org>2012-07-26 11:31:00 -0400
commit55b073bae6824a5252ea11a59a0660507b5b53c5 (patch)
treeae53d6cf4616fac118eef13ca6078d2edad842a1 /contrib
parente902c2664729f6f4c624c01b2261b4963e7a72ef (diff)
downloadgcc-55b073bae6824a5252ea11a59a0660507b5b53c5.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. From-SVN: r189893
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