[csw-devel] SF.net SVN: gar:[13955] csw/mgar/gar/v2/lib/python/package.py

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Mar 27 22:17:31 CEST 2011


Revision: 13955
          http://gar.svn.sourceforge.net/gar/?rev=13955&view=rev
Author:   bdwalton
Date:     2011-03-27 20:17:31 +0000 (Sun, 27 Mar 2011)

Log Message:
-----------
checkpkg/package.py: deduplicate return info from GetObsoletedBy

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/package.py

Modified: csw/mgar/gar/v2/lib/python/package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package.py	2011-03-27 20:03:04 UTC (rev 13954)
+++ csw/mgar/gar/v2/lib/python/package.py	2011-03-27 20:17:31 UTC (rev 13955)
@@ -380,27 +380,26 @@
     may be empty.  It will always contain the valid entries.
     """
 
+    has_obsolete_info = False
     obsoleted_syntax_ok = True
     obsoleted_by = []
     obsoleted_by_path = os.path.join(self.directory, "install", "obsolete")
 
-    if not os.path.exists(obsoleted_by_path):
-      return { "syntax_ok": True,
-               "obsoleted_by": obsoleted_by,
-               "has_obsolete_info": False }
+    if os.path.exists(obsoleted_by_path):
+      has_obsolete_info = True
+      with open(obsoleted_by_path, "r") as fd:
+        for line in fd:
+          fields = re.split(c.WS_RE, line)
+          if len(fields) < 2:
+            obsoleted_syntax_ok = False
+            logging.warning("Bad line in obsolete file: %s", repr(line))
+            continue
+          pkgname, catalogname = fields[0:2]
+          obsoleted_by.append((pkgname, catalogname))
 
-    with open(obsoleted_by_path, "r") as fd:
-      for line in fd:
-        fields = re.split(c.WS_RE, line)
-        if len(fields) < 2:
-          obsoleted_syntax_ok = False
-          logging.warning("Bad line in obsolete file: %s", repr(line))
-          continue
-        pkgname, catalogname = fields[0:2]
-        obsoleted_by.append((pkgname, catalogname))
     return { "syntax_ok": obsoleted_syntax_ok,
              "obsoleted_by": obsoleted_by,
-             "has_obsolete_info": True }
+             "has_obsolete_info": has_obsolete_info }
 
   def CheckPkgpathExists(self):
     if not os.path.isdir(self.directory):


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list