]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blobdiff - wwwbin/clean-dups.py
Make ftp tools python3 ready
[projects/pld-ftp-admin.git] / wwwbin / clean-dups.py
index 003b538a072024bad92a62f1d3583e5d1a9e953a..280691586bf30a7c64b866802e6f4ff267abc9f1 100755 (executable)
@@ -2,6 +2,8 @@
 # arekm, 2008
 # remove 
 
+from __future__ import print_function
+
 import os
 import re
 import time
@@ -49,19 +51,19 @@ def compare(f1, f2):
        try:
                fd1 = os.open(os.path.join(dir, f1), os.O_RDONLY)
        except Exception, e:
-               print e
+               print(e)
                # ignore non-files
                return 0
        try:
                fd2 = os.open(os.path.join(dir, f2), os.O_RDONLY)
        except Exception, e:
-               print e
+               print(e)
                # ignore non-files
                return 0
        try:
                h1 = ts.hdrFromFdno(fd1)
        except Exception, e:
-               print "hdrFromFdno for %s failed: %s" % (f1, e)
+               print("hdrFromFdno for %s failed: %s" % (f1, e))
                os.close(fd1)
                os.close(fd2)
                return 0
@@ -69,7 +71,7 @@ def compare(f1, f2):
        try:
                h2 = ts.hdrFromFdno(fd2)
        except Exception, e:
-               print "hdrFromFdno for %s failed: %s" % (f2, e)
+               print("hdrFromFdno for %s failed: %s" % (f2, e))
                os.close(fd1)
                os.close(fd2)
                return 0
@@ -101,7 +103,7 @@ for file in os.listdir(dir):
 
        m = re_nvr.match(file)
        if not m:
-               print "problem with: %s" % file
+               print("problem with: %s" % file)
                sys.exit(1)
 
        if len(sys.argv) == 0:
@@ -121,7 +123,7 @@ for file in os.listdir(dir):
        else:
                files[name] = file
 
-for i in dupes.iterkeys():
+for i in iter(dupes.keys()):
        for old in find_old(dupes[i])[1:]:
-               print "removing: %s" % old
+               print("removing: %s" % old)
                os.system("/home/pld/admins/th/pld-ftp-admin/scripts/remove.py test %s" % old)
This page took 0.044193 seconds and 4 git commands to generate.