]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not use 'with ... as ...' in validate_failures.py
authorDiego Novillo <dnovillo@google.com>
Thu, 26 Jul 2012 15:31:00 +0000 (11:31 -0400)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Thu, 26 Jul 2012 15:31:00 +0000 (11:31 -0400)
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

contrib/ChangeLog
contrib/testsuite-management/validate_failures.py

index ee68edba2e533b39c7d180b61afe0367edfb600b..b1a1d5fe189a3176bbd176becac43f3a425afdbb 100644 (file)
@@ -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):
index c48e4c3de7032d142339747d97d7156795b612d1..ef01938f02e174d7b74ac69ec7cf66523c0f24d3 100755 (executable)
@@ -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