[Osgeo4w-commits] r1187 - trunk/apt

svn_osgeo4w at osgeo.org svn_osgeo4w at osgeo.org
Thu Apr 5 01:44:34 EDT 2012


Author: maphew
Date: 2012-04-04 22:44:34 -0700 (Wed, 04 Apr 2012)
New Revision: 1187

Modified:
   trunk/apt/apt.py
Log:
more #53, and refactor `def md5` a bit to use get_ball() instead of rebuilding the tarball filename redundantly



Modified: trunk/apt/apt.py
===================================================================
--- trunk/apt/apt.py	2012-04-05 05:28:11 UTC (rev 1186)
+++ trunk/apt/apt.py	2012-04-05 05:44:34 UTC (rev 1187)
@@ -103,8 +103,9 @@
     '''print full path name of package archive'''
     if not packagename:
             sys.stderr.write ('No package specified. Run "apt list" to see installed packages')
-    else:
-        print get_ball ()
+            return
+    
+    print get_ball ()
 
 #@+node:maphew.20100223163802.3721: *3* download
 def download ():
@@ -219,13 +220,17 @@
 #@+node:maphew.20100223163802.3726: *3* md5
 def md5 ():
     '''check md5 sum'''
+    if not packagename:
+        sys.stderr.write ('No package specified. Try running "apt list"')
+        return
+        
     url, md5 = get_url ()
     ball = os.path.basename (url)
     print '%s  %s - remote' % (md5, ball)
 
     # make sure we md5 the *file* not the *filename*
     # kudos to http://www.peterbe.com/plog/using-md5-to-check-equality-between-files
-    localFile = file(os.path.join(downloads, url), 'rb')
+    localFile = file(get_ball(), 'rb')
     my_md5 = hashlib.md5(localFile.read()).hexdigest()
 
     print '%s  %s - local' % (my_md5, ball)



More information about the osgeo4w-commits mailing list