]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blobdiff - wwwbin/dump-packagenames.py
Fix exception handling syntax (python3 compat)
[projects/pld-ftp-admin.git] / wwwbin / dump-packagenames.py
old mode 100644 (file)
new mode 100755 (executable)
index 7bdbd75..61e890b
@@ -1,17 +1,19 @@
 #!/usr/bin/python
 
+from __future__ import print_function
+
 import os
 import re
 
 import rpm
 
-dirs = ['/home/services/ftp/pld/dists/3.0/PLD/i486/RPMS',
+dirs = ['/home/services/ftp/pld/dists/3.0/PLD/x32/RPMS',
                '/home/services/ftp/pld/dists/3.0/PLD/i686/RPMS',
                '/home/services/ftp/pld/dists/3.0/PLD/x86_64/RPMS',
-               '/home/services/ftp/pld/dists/3.0/ready/i486/RPMS',
+               '/home/services/ftp/pld/dists/3.0/ready/x32/RPMS',
                '/home/services/ftp/pld/dists/3.0/ready/i686/RPMS',
                '/home/services/ftp/pld/dists/3.0/ready/x86_64/RPMS',
-               '/home/services/ftp/pld/dists/3.0/test/i486/RPMS',
+               '/home/services/ftp/pld/dists/3.0/test/x32/RPMS',
                '/home/services/ftp/pld/dists/3.0/test/i686/RPMS',
                '/home/services/ftp/pld/dists/3.0/test/x86_64/RPMS']
 
@@ -35,8 +37,8 @@ for dir in dirs:
                fdno = os.open(rpm_file, os.O_RDONLY)
                try:
                        hdr = ts.hdrFromFdno(fdno)
-               except Exception, e:
-                       print "hdrFromFdno: %s: %s" % (rpm_file, e)
+               except Exception as e:
+                       print("hdrFromFdno: %s: %s" % (rpm_file, e))
                        os.close(fdno)
                        continue
                os.close(fdno)
@@ -45,13 +47,13 @@ for dir in dirs:
                sourcerpm = hdr[rpm.RPMTAG_SOURCERPM]
                m = re_nvr.match(sourcerpm)
                if not m:
-                       print "%s: doesn't match src.rpm file name" % (sourcerpm)
+                       print("%s: doesn't match src.rpm file name" % (sourcerpm))
                        continue
                srcname = m.group(1)
                pkgs[name] = srcname
 
 f = open(outname + ".tmp", "w")
-for (pkg, spkg) in pkgs.iteritems():
+for (pkg, spkg) in iter(pkgs.items()):
        f.write("%s:%s\n" % (pkg, spkg))
 f.close()
 os.chmod(outname + ".tmp", 0644)
This page took 0.034698 seconds and 4 git commands to generate.