aports/testing/pyplucker/decode_python3.patch
2024-01-03 18:11:00 +00:00

65 lines
1.9 KiB
Diff

#Convert python2 to python3
--- a/PyPlucker/Decode.py
+++ b/PyPlucker/Decode.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
"""
Decode.py $Id: Decode.py,v 1.4 2002/05/18 10:28:24 nordstrom Exp $
@@ -17,7 +17,7 @@
pdb = helper.prc.File(pdbfile,read=1,write=0)
for i in range(pdb.getRecords()):
raw,tmp,id,attr,category = pdb.getRecord(i)
- print "Writing ID: %d" % id
+ print("Writing ID: %d" % id)
cache_file = open(os.path.join(cachedir,"%d" % id),"w")
cache_file.write(raw)
cache_file.close()
@@ -25,13 +25,13 @@
def main(argv):
def usage():
- print "Usage: %s [-h] [-v] [-c <cachedir>] dbfile" % sys.argv[0]
- print "WARNING: THE CACHE DIRECTORY GETS ERASED !!!"
- print "You have been warned."
+ print("Usage: %s [-h] [-v] [-c <cachedir>] dbfile" % sys.argv[0])
+ print("WARNING: THE CACHE DIRECTORY GETS ERASED !!!")
+ print("You have been warned.")
try:
optlist,args = getopt.getopt(argv[1:],"hvc:",['help','version'])
- except getopt.error,msg:
- print msg
+ except getopt.error.msg:
+ print(msg)
usage()
sys.exit(1)
@@ -42,22 +42,22 @@
usage()
sys.exit(0)
elif arg=='-v' or arg=='--version':
- print "$Revision: 1.4 $"
+ print("$Revision: 1.4 $")
sys.exit(0)
elif arg=='-c':
cachedir=value
if len(args)!=1:
- print "Error on command line"
+ print("Error on command line")
usage()
sys.exit(1)
pdbfile = args[0]
if not os.path.exists(pdbfile):
- print "Database %s doesn't exist." % pdbfile
+ print("Database %s doesn't exist." % pdbfile)
sys.exit(1)
if os.path.exists(cachedir):
- print "Removing %s." % cachedir
+ print("Removing %s." % cachedir)
shutil.rmtree(cachedir)
os.mkdir(cachedir)