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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Mar 28 10:47:14 CEST 2011


Revision: 13975
          http://gar.svn.sourceforge.net/gar/?rev=13975&view=rev
Author:   wahwah
Date:     2011-03-28 08:47:14 +0000 (Mon, 28 Mar 2011)

Log Message:
-----------
checkpkg: Change GetDependencies to 'with'

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-28 05:01:11 UTC (rev 13974)
+++ csw/mgar/gar/v2/lib/python/package.py	2011-03-28 08:47:14 UTC (rev 13975)
@@ -346,16 +346,15 @@
     depend_file_path = os.path.join(self.directory, "install", "depend")
     if not os.path.exists(depend_file_path):
       return depends
-    fd = open(os.path.join(self.directory, "install", "depend"), "r")
-    # It needs to be a list because there might be duplicates and it's
-    # necessary to carry that information.
-    for line in fd:
-      fields = re.split(c.WS_RE, line)
-      if fields[0] == "P":
-        pkgname = fields[1]
-        pkg_desc = " ".join(fields[1:])
-        depends.append((pkgname, pkg_desc))
-    fd.close()
+    with open(depend_file_path, "r") as fd:
+      # It needs to be a list because there might be duplicates and it's
+      # necessary to carry that information.
+      for line in fd:
+        fields = re.split(c.WS_RE, line)
+        if fields[0] == "P":
+          pkgname = fields[1]
+          pkg_desc = " ".join(fields[1:])
+          depends.append((pkgname, pkg_desc))
     return depends
 
   def GetObsoletedBy(self):


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