--- java-gnome-4.1.3/build/faster 2013-05-05 03:08:23.000000000 +0200
+++ java-gnome-4.1.3/build/faster.py3 2020-08-09 12:27:56.515402857 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# vim: set fileencoding=UTF-8
#
# java-gnome, a UI library for writing GTK and GNOME programs from Java!
@@ -49,7 +49,7 @@
# bring to the process when it lands, so it is a step in the right direction.
#
-import os, hashlib, subprocess, cPickle, sys
+import os, hashlib, subprocess, pickle, sys
from os.path import *
from shutil import move
@@ -85,7 +85,7 @@
flock(lock, LOCK_EX | LOCK_NB)
except IOError:
if not silent:
- print "Inhibited: another build process already running"
+ print("Inhibited: another build process already running")
sys.stdout.flush()
sys.exit(0)
@@ -109,16 +109,16 @@
def loadConfig():
global config
if ((not isfile(configFile)) or (getmtime(configFile) < getmtime(versionFile))):
- print
- print "You need to run ./configure to check prerequisites"
- print "and setup preferences before you can build java-gnome."
+ print()
+ print("You need to run ./configure to check prerequisites")
+ print("and setup preferences before you can build java-gnome.")
if not os.access("configure", os.X_OK):
- print "I'll make it executable for you."
- print
+ print("I'll make it executable for you.")
+ print()
executeCommand("CHMOD", "configure", "chmod +x configure")
else:
- print
+ print()
sys.exit(1)
try:
@@ -132,7 +132,7 @@
cfg.close()
except (EOFError):
- print "Error while trying to read .config"
+ print("Error while trying to read .config")
sys.exit(9)
config['GNOME_CCFLAGS'] = os.popen("pkg-config --cflags " + GNOME_MODULES).read().rstrip()
@@ -144,10 +144,10 @@
if isfile(hashFile):
try:
db = open(hashFile, "rb")
- hashes = cPickle.load(db)
+ hashes = pickle.load(db)
db.close()
except (EOFError, KeyError, IndexError):
- print "build checksum cache corrupt; full rebuild forced"
+ print("build checksum cache corrupt; full rebuild forced")
hashes = {}
@@ -159,7 +159,7 @@
def checkpointHashes():
db = open(hashFile + ".tmp", "wb")
- cPickle.dump(hashes, db)
+ pickle.dump(hashes, db)
db.close()
move(hashFile + ".tmp", hashFile)
@@ -217,7 +217,7 @@
#
def sourceChanged(file, hash):
- if hashes.has_key(file):
+ if file in hashes:
if hashes[file] == hash:
return False
return True
@@ -229,7 +229,7 @@
def debug(args):
if False:
- print args,
+ print(args, end=' ')
def filesNeedBuilding(list, update=True):
@@ -244,9 +244,8 @@
if not isfile(source):
sys.exit(source + " missing, abort")
- f = open(source)
- m = hashlib.md5(f.read())
- f.close()
+ with open(source, 'rb') as f:
+ m = hashlib.md5(f.read())
hash = m.hexdigest()
debug("CHECK\t"+str(target)+" from "+source+"\n")
@@ -331,9 +330,9 @@
def executeCommand(short, what, cmd, inDir=None):
sys.stderr.flush()
if not silent:
- print short + "\t" + what
+ print(short + "\t" + what)
if verbose:
- print cmd
+ print(cmd)
sys.stdout.flush()
status = subprocess.call(cmd, shell=True, cwd=inDir, bufsize=1)
@@ -497,7 +496,7 @@
def compileCSourceToObject(source, target):
ensureDirectory(dirname(target))
- if config.has_key('CCACHE'):
+ if 'CCACHE' in config:
cmd = config['CCACHE'] + " "
else:
cmd = ""
@@ -739,5 +738,5 @@
try:
main()
except KeyboardInterrupt:
- print
+ print()