[Lsb-messages] /var/www/bzr/lsb/devel/appbat r1007: comment out the functions using 'with open(...' entirely - avoid mystery syntax error?

Mats Wichmann mats at linuxfoundation.org
Fri Dec 30 18:02:37 UTC 2016


------------------------------------------------------------
revno: 1007
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: appbat
timestamp: Fri 2016-12-30 11:02:37 -0700
message:
  comment out the functions using 'with open(...' entirely - avoid mystery syntax error?
modified:
  extras/entitycheck.py
-------------- next part --------------
=== modified file 'extras/entitycheck.py'
--- a/extras/entitycheck.py	2016-12-30 16:07:20 +0000
+++ b/extras/entitycheck.py	2016-12-30 18:02:37 +0000
@@ -107,7 +107,7 @@
 
     def __str__(self):
         """Entity class "string" is "\tfilename", as that's what some things want to print"""
-        return '\t{}'.format(self.file)
+        return '\t%s' % self.file
 
     BLOCKSIZE = 1024 * 1024
 
@@ -277,15 +277,15 @@
                 return 0
 
 
-def parse_packages():
-    """Look for package files in the entities file. desired lines look like:
-      <!ENTITY foo-package "foo-1.2.tar.bz2">, but we need to skip XML comments.
-      Returns a match object"""
-
-    with open(epaths['entity_file']) as entities:
-        for line in entities.readlines():
-            if not re.search('<!--', line):
-                yield re.search(r'(\S+)-package\s+"([^"]+)"', line)
+#def parse_packages():
+#    """Look for package files in the entities file. desired lines look like:
+#      <!ENTITY foo-package "foo-1.2.tar.bz2">, but we need to skip XML comments.
+#      Returns a match object"""
+#
+#    with open(epaths['entity_file']) as entities:
+#        for line in entities.readlines():
+#            if not re.search('<!--', line):
+#                yield re.search(r'(\S+)-package\s+"([^"]+)"', line)
 
 
 def parse_packages_oldpy():
@@ -306,15 +306,15 @@
     entities.close()
 
 
-def parse_patches():
-    """Look for package files in the entities file. desired lines look like:
-     <!ENTITY foo-patch "foo-1.2.patch">, but we need to skip XML comments.
-     Returns a match object"""
-
-    with open(epaths['entity_file']) as entities:
-        for line in entities.readlines():
-            if not re.search('<!--', line):
-                yield re.search(r'(\S+)-patch\s+"([^"]+)"', line)
+#def parse_patches():
+#    """Look for package files in the entities file. desired lines look like:
+#     <!ENTITY foo-patch "foo-1.2.patch">, but we need to skip XML comments.
+#     Returns a match object"""
+#
+#    with open(epaths['entity_file']) as entities:
+#        for line in entities.readlines():
+#            if not re.search('<!--', line):
+#                yield re.search(r'(\S+)-patch\s+"([^"]+)"', line)
 
 
 def parse_patches_oldpy():
@@ -343,12 +343,15 @@
     # apply a regular expression match, which we hope we can write adequately
     # cue stock regular expressions joke ("now you have two problems")
 
-    if sys.version_info >= (2, 5):
-        pkg_parser = parse_packages
-        pch_parser = parse_patches
-    else:
-        pkg_parser = parse_packages_oldpy
-        pch_parser = parse_patches_oldpy
+    # TODO: builders having problems on line "with open(..."
+    # using a version-based check didn't fix it, so now just calling 
+    # non-with version to see if that resolves it
+    #if sys.version_info >= (2, 5):
+    #    pkg_parser = parse_packages
+    #    pch_parser = parse_patches
+    #else:
+    pkg_parser = parse_packages_oldpy
+    pch_parser = parse_patches_oldpy
 
     packages = [Entity.from_re_match(match) for match in pkg_parser() if match]
     patches = [Entity.from_re_match(match) for match in pch_parser() if match]



More information about the lsb-messages mailing list