winfreed.py: rename 'package' field to 'package_name'
authorAntonio Ospite <ospite@studenti.unina.it>
Sat, 26 Nov 2011 11:49:37 +0000 (12:49 +0100)
committerAntonio Ospite <ospite@studenti.unina.it>
Sat, 26 Nov 2011 11:49:37 +0000 (12:49 +0100)
winfreed.py

index 370caff..f4596b6 100755 (executable)
@@ -39,12 +39,12 @@ def process_all(path, cb):
             pkg = json.load(f)
             basename = os.path.basename(json_file)
             package_name = os.path.splitext(basename)[0]
             pkg = json.load(f)
             basename = os.path.basename(json_file)
             package_name = os.path.splitext(basename)[0]
-            pkg['package'] = package_name
+            pkg['package_name'] = package_name
             cb(pkg)
             f.close()
 
 def show(pkg):
             cb(pkg)
             f.close()
 
 def show(pkg):
-    print 'Package:  ', pkg['package']
+    print 'Package:  ', pkg['package_name']
     print 'Program:  ', pkg['name']
     print 'Homepage: ', pkg['homepage']
     print
     print 'Program:  ', pkg['name']
     print 'Homepage: ', pkg['homepage']
     print
@@ -60,12 +60,12 @@ def download(pkg):
     response = urllib2.urlopen(url)
     filename = urllib2.unquote(os.path.basename(response.geturl()))
     if filename == "":
     response = urllib2.urlopen(url)
     filename = urllib2.unquote(os.path.basename(response.geturl()))
     if filename == "":
-        sys.stderr.write("Debug (%s): filename: %s url: %s\n" %(pkg['package'], filename, response.geturl()))
+        sys.stderr.write("Debug (%s): filename: %s url: %s\n" %(pkg['package_name'], filename, response.geturl()))
         return
 
     destfile = os.path.join(OUTPUT_DIR, filename)
     if os.path.exists(destfile):
         return
 
     destfile = os.path.join(OUTPUT_DIR, filename)
     if os.path.exists(destfile):
-        sys.stderr.write("Warning (%s): %s exists!\n" % (pkg['package'], destfile))
+        sys.stderr.write("Warning (%s): %s exists!\n" % (pkg['package_name'], destfile))
         return
 
     outfile = open(destfile, mode='w')
         return
 
     outfile = open(destfile, mode='w')