[projects/pld-ftp-admin] pfa-checktree: make it run on Python 3
arekm
arekm at pld-linux.org
Sat Oct 24 11:45:54 CEST 2026
commit a8024fa1e7e29fa7c50e430870e5fec6d3e4388f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue Oct 20 15:33:44 2026 +0200
pfa-checktree: make it run on Python 3
bin/pfa-checktree | 8 +++++---
modules/ftptree.py | 13 +++++--------
2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/bin/pfa-checktree b/bin/pfa-checktree
index 5551880..c3fcd77 100755
--- a/bin/pfa-checktree
+++ b/bin/pfa-checktree
@@ -20,6 +20,7 @@ if len(sys.argv) != 3:
sys.exit(1)
checkdir(sys.argv[1])
+checkdir(sys.argv[2])
ftpio.connect('check-tree')
@@ -63,7 +64,8 @@ pkglist=[]
for key in sorted(pkgtree.keys()):
pkglist=pkglist+pkgtree[key]
-DoQuit="OMG!"
+class DoQuit(Exception):
+ pass
class Screen:
def __init__(self, srctreename, dsttreename, elements):
@@ -288,14 +290,14 @@ class Screen:
c=chr(key)
for bind in self.globalkeys+self.perwindowkeys[self.window-1]:
if not bind[0].startswith('KEY_') and c in bind[0]:
- exec 'self._Screen__do_%s()' % bind[1]
+ getattr(self, '_Screen__do_%s' % bind[1])()
else:
# self.elements[0]=repr(key)
for bind in self.globalkeys+self.perwindowkeys[self.window-1]:
if bind[0].startswith('KEY_'):
if key == getattr(curses, bind[0]):
- exec 'self._Screen__do_%s()' % bind[1]
+ getattr(self, '_Screen__do_%s' % bind[1])()
s = Screen(sys.argv[1], sys.argv[2], pkglist)
diff --git a/modules/ftptree.py b/modules/ftptree.py
index 668a80a..5dd27b4 100644
--- a/modules/ftptree.py
+++ b/modules/ftptree.py
@@ -76,14 +76,11 @@ class Pkg(BasePkg):
self.errors = []
self.warnings = []
- def __cmp__(self, pkg):
- if self.name > pkg.name:
- return 1
- elif self.name < pkg.name:
- return -1
- else:
- return rpm.labelCompare(('0', self.version, self.release),
- ('0', pkg.version, pkg.release))
+ def __lt__(self, pkg):
+ if self.name != pkg.name:
+ return self.name < pkg.name
+ return rpm.labelCompare(('0', self.version, self.release),
+ ('0', pkg.version, pkg.release)) < 0
# unfortunately can't do new Pkg(NVR), and have no "tree" in this pkg context
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/e14cb7d4d74f8bdd9368d9645ecaf49593cf6335
More information about the pld-cvs-commit
mailing list