[csw-devel] SF.net SVN: gar:[19826] csw/mgar/gar/v2/lib/python/package.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Thu Dec 6 10:22:50 CET 2012
Revision: 19826
http://gar.svn.sourceforge.net/gar/?rev=19826&view=rev
Author: wahwah
Date: 2012-12-06 09:22:49 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
checkpkg: use 'with' to open .pkg files
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 2012-12-05 23:11:26 UTC (rev 19825)
+++ csw/mgar/gar/v2/lib/python/package.py 2012-12-06 09:22:49 UTC (rev 19826)
@@ -190,10 +190,9 @@
def GetMd5sum(self):
if not self.md5sum:
logging.debug("GetMd5sum() reading file %s", repr(self.pkg_path))
- fp = open(self.pkg_path)
hash = hashlib.md5()
- hash.update(fp.read())
- fp.close()
+ with open(self.pkg_path) as fp:
+ hash.update(fp.read())
self.md5sum = hash.hexdigest()
return self.md5sum
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