From 655f3703ab1bbeb0df17485fe691a71bb4f69a8d Mon Sep 17 00:00:00 2001 From: Alexander Boström Date: Aug 09 2020 10:40:04 +0000 Subject: Fix build script for Python 3 --- diff --git a/java-gnome-4.1.3-py3.patch b/java-gnome-4.1.3-py3.patch new file mode 100644 index 0000000..6d96a9c --- /dev/null +++ b/java-gnome-4.1.3-py3.patch @@ -0,0 +1,138 @@ +--- 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() + diff --git a/java-gnome.spec b/java-gnome.spec index 01efd8a..3874b44 100644 --- a/java-gnome.spec +++ b/java-gnome.spec @@ -1,7 +1,7 @@ Summary: Java GNOME bindings Name: java-gnome Version: 4.1.3 -Release: 24%{?dist} +Release: 25%{?dist} URL: http://java-gnome.sourceforge.net Source0: http://ftp.gnome.org/pub/gnome/sources/java-gnome/4.1/java-gnome-%{version}.tar.xz # Workaround for brp-java-repack-jars skipping top-level dot-files @@ -12,6 +12,8 @@ Patch1: java-gnome-doclint.patch Patch2: java-gnome-4.1.3-javaargs.patch # Use "javac -h" instead of "javah" for JDK 11 compatibility Patch3: java-gnome-4.1.3-javah.patch +# Fix build script for Python 3 +Patch4: java-gnome-4.1.3-py3.patch # This is the "Classpath" exception. License: GPLv2 with exceptions BuildRequires: pkgconfig @@ -29,7 +31,7 @@ BuildRequires: pkgconfig(pango) BuildRequires: pkgconfig(librsvg-2.0) BuildRequires: gettext BuildRequires: junit -BuildRequires: python2 +BuildRequires: python3 BuildRequires: java-devel >= 1:1.6.0 BuildRequires: jpackage-utils BuildRequires: perl @@ -63,6 +65,7 @@ design documentation and sample code. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # Remove all binaries find . -name "*.jar" -exec rm -f {} \; @@ -113,6 +116,9 @@ cp -rp doc/api %{buildroot}%{_javadocdir}/%{name} %{_javadocdir}/%{name} %changelog +* Sun Sug 09 2020 Alexander Boström - 4.1.3-25 +- Switch to Python 3 for build + * Wed Jul 29 2020 Mat Booth - 4.1.3-24 - Fix javah usage for JDK 11 compatibility