diff --git a/0001-Migrate-Gtk-interface-to-GObject-introspection.patch b/0001-Migrate-Gtk-interface-to-GObject-introspection.patch new file mode 100644 index 0000000..1ec1ca9 --- /dev/null +++ b/0001-Migrate-Gtk-interface-to-GObject-introspection.patch @@ -0,0 +1,239 @@ +From 5ba871c0851dbff28320ec5887960a90a7aab260 Mon Sep 17 00:00:00 2001 +From: Haikel Guemar +Date: Fri, 30 Nov 2018 14:30:08 +0100 +Subject: [PATCH] Migrate Gtk interface to GObject introspection + +Filters subunit2gtk and subunit-notify now uses GObject introspection +Both are compatible with python2 and python3 +--- + filters/subunit-notify | 10 +++--- + filters/subunit2gtk | 80 +++++++++++++++++++++--------------------- + 2 files changed, 45 insertions(+), 45 deletions(-) + +diff --git a/filters/subunit-notify b/filters/subunit-notify +index bc833da..71da071 100755 +--- a/filters/subunit-notify ++++ b/filters/subunit-notify +@@ -16,15 +16,15 @@ + + """Notify the user of a finished test run.""" + +-import pygtk +-pygtk.require('2.0') +-import pynotify ++import gi ++gi.require_version('Gtk', '3.0') ++from gi.repository import Notify + from testtools import StreamToExtendedDecorator + + from subunit import TestResultStats + from subunit.filters import run_filter_script + +-if not pynotify.init("Subunit-notify"): ++if not Notify.init("Subunit-notify"): + sys.exit(1) + + +@@ -39,7 +39,7 @@ def notify_of_result(result): + result.passed_tests, + result.failed_tests, + ) +- nw = pynotify.Notification(summary, body) ++ nw = Notify.Notification(summary, body) + nw.show() + + +diff --git a/filters/subunit2gtk b/filters/subunit2gtk +index 78b4309..5c0ebe3 100755 +--- a/filters/subunit2gtk ++++ b/filters/subunit2gtk +@@ -49,9 +49,9 @@ import sys + import threading + import unittest + +-import pygtk +-pygtk.require('2.0') +-import gtk, gtk.gdk, gobject ++import gi ++gi.require_version('Gtk', '3.0') ++from gi.repository import Gtk, GObject + + from testtools import StreamToExtendedDecorator + +@@ -75,64 +75,64 @@ class GTKTestResult(unittest.TestResult): + self.not_ok_label = None + self.total_tests = None + +- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) ++ self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL) + self.window.set_resizable(True) + +- self.window.connect("destroy", gtk.main_quit) ++ self.window.connect("destroy", Gtk.main_quit) + self.window.set_title("Tests...") + self.window.set_border_width(0) + +- vbox = gtk.VBox(False, 5) ++ vbox = Gtk.VBox(False, 5) + vbox.set_border_width(10) + self.window.add(vbox) + vbox.show() + + # Create a centering alignment object +- align = gtk.Alignment(0.5, 0.5, 0, 0) ++ align = Gtk.Alignment.new(0.5, 0.5, 0, 0) + vbox.pack_start(align, False, False, 5) + align.show() + + # Create the ProgressBar +- self.pbar = gtk.ProgressBar() ++ self.pbar = Gtk.ProgressBar() + align.add(self.pbar) + self.pbar.set_text("Running") + self.pbar.show() + self.progress_model = ProgressModel() + +- separator = gtk.HSeparator() ++ separator = Gtk.HSeparator() + vbox.pack_start(separator, False, False, 0) + separator.show() + + # rows, columns, homogeneous +- table = gtk.Table(2, 3, False) ++ table = Gtk.Table(2, 3, False) + vbox.pack_start(table, False, True, 0) + table.show() + # Show summary details about the run. Could use an expander. +- label = gtk.Label("Run:") +- table.attach(label, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ label = Gtk.Label(label="Run:") ++ table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + label.show() +- self.run_label = gtk.Label("N/A") +- table.attach(self.run_label, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ self.run_label = Gtk.Label(label="N/A") ++ table.attach(self.run_label, 1, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + self.run_label.show() + +- label = gtk.Label("OK:") +- table.attach(label, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ label = Gtk.Label(label="OK:") ++ table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + label.show() +- self.ok_label = gtk.Label("N/A") +- table.attach(self.ok_label, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ self.ok_label = Gtk.Label(label="N/A") ++ table.attach(self.ok_label, 1, 2, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + self.ok_label.show() + +- label = gtk.Label("Not OK:") +- table.attach(label, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ label = Gtk.Label(label="Not OK:") ++ table.attach(label, 0, 1, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + label.show() +- self.not_ok_label = gtk.Label("N/A") +- table.attach(self.not_ok_label, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, +- gtk.EXPAND | gtk.FILL, 5, 5) ++ self.not_ok_label = Gtk.Label(label="N/A") ++ table.attach(self.not_ok_label, 1, 2, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, ++ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5) + self.not_ok_label.show() + + self.window.show() +@@ -142,7 +142,7 @@ class GTKTestResult(unittest.TestResult): + + def stopTest(self, test): + super(GTKTestResult, self).stopTest(test) +- gobject.idle_add(self._stopTest) ++ GObject.idle_add(self._stopTest) + + def _stopTest(self): + self.progress_model.advance() +@@ -159,26 +159,26 @@ class GTKTestResult(unittest.TestResult): + super(GTKTestResult, self).stopTestRun() + except AttributeError: + pass +- gobject.idle_add(self.pbar.set_text, 'Finished') ++ GObject.idle_add(self.pbar.set_text, 'Finished') + + def addError(self, test, err): + super(GTKTestResult, self).addError(test, err) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def addFailure(self, test, err): + super(GTKTestResult, self).addFailure(test, err) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def addSuccess(self, test): + super(GTKTestResult, self).addSuccess(test) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def addSkip(self, test, reason): + # addSkip is new in Python 2.7/3.1 + addSkip = getattr(super(GTKTestResult, self), 'addSkip', None) + if callable(addSkip): + addSkip(test, reason) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def addExpectedFailure(self, test, err): + # addExpectedFailure is new in Python 2.7/3.1 +@@ -186,7 +186,7 @@ class GTKTestResult(unittest.TestResult): + 'addExpectedFailure', None) + if callable(addExpectedFailure): + addExpectedFailure(test, err) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def addUnexpectedSuccess(self, test): + # addUnexpectedSuccess is new in Python 2.7/3.1 +@@ -194,7 +194,7 @@ class GTKTestResult(unittest.TestResult): + 'addUnexpectedSuccess', None) + if callable(addUnexpectedSuccess): + addUnexpectedSuccess(test) +- gobject.idle_add(self.update_counts) ++ GObject.idle_add(self.update_counts) + + def progress(self, offset, whence): + if whence == PROGRESS_PUSH: +@@ -218,12 +218,12 @@ class GTKTestResult(unittest.TestResult): + self.ok_label.set_text(str(self.testsRun - bad)) + self.not_ok_label.set_text(str(bad)) + +-gobject.threads_init() ++GObject.threads_init() + result = StreamToExtendedDecorator(GTKTestResult()) + test = ByteStreamToStreamResult(sys.stdin, non_subunit_name='stdout') + # Get setup +-while gtk.events_pending(): +- gtk.main_iteration() ++while Gtk.events_pending(): ++ Gtk.main_iteration() + # Start IO + def run_and_finish(): + test.run(result) +@@ -232,7 +232,7 @@ t = threading.Thread(target=run_and_finish) + t.daemon = True + result.startTestRun() + t.start() +-gtk.main() ++Gtk.main() + if result.decorated.wasSuccessful(): + exit_code = 0 + else: +-- +2.19.2 + diff --git a/subunit.spec b/subunit.spec index 029dc50..68138a8 100644 --- a/subunit.spec +++ b/subunit.spec @@ -6,7 +6,7 @@ Name: subunit Version: 1.3.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: C bindings for subunit %global majver %(cut -d. -f-2 <<< %{version}) @@ -18,6 +18,10 @@ Source0: https://launchpad.net/%{name}/trunk/%{majver}/+download/%{name}- Patch0: %{name}-unbundle-iso8601.patch # Merged upsteam: https://github.com/testing-cabal/subunit/pull/10 Patch1: %{name}-decode-binary-to-unicode.patch +# Migrate Gtk interface to GObject introspection +# Upstream PR: https://github.com/testing-cabal/subunit/pull/34 +Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch + BuildRequires: check-devel BuildRequires: cppunit-devel @@ -160,9 +164,17 @@ A number of useful things can be done easily with subunit: %package filters Summary: Command line filters for processing subunit streams BuildArch: noarch +%if %{with python3} +Requires: python3-%{name} = %{version}-%{release} +Requires: python3-gobject +Requires: gtk3 >= 3.20 +Requires: libnotify >= 0.7.7 +Requires: python3-junitxml +%else Requires: python2-%{name} = %{version}-%{release} Requires: pygtk2 Requires: python2-junitxml +%endif %description filters Command line filters for processing subunit streams. @@ -180,6 +192,7 @@ test cases. %setup -qc %patch0 %patch1 -p1 +%patch2 -p1 fixtimestamp() { touch -r $1.orig $1 @@ -189,6 +202,10 @@ fixtimestamp() { # Help the dependency generator for filt in filters/*; do sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new +%if %{with python3} +# Fix filters to use python3 + sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new +%endif chmod 0755 ${filt}.new touch -r $filt ${filt}.new mv -f ${filt}.new $filt @@ -262,7 +279,9 @@ popd %endif %install -# Install for python 3 first so that the python 2 install overwrites files +# Install for python 2 first so that the python 3 install overwrites files +%py2_install + %if %{with python3} pushd python3 %py3_install @@ -285,9 +304,6 @@ popd # We set pkgpython_PYTHON for efficiency to disable automake python compilation %make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p" -# Install the python interface -%py2_install - # Replace bundled code with a symlink again for fil in iso8601.py iso8601.pyc iso8601.pyo; do ln -f -s %{python2_sitelib}/iso8601/$fil \ @@ -394,6 +410,10 @@ popd %exclude %{_bindir}/%{name}-diff %changelog +* Fri Nov 30 2018 Haïkel Guémar - 1.3.0-4 +- Migrate GUI filters to Gtk3/GObject introspection +- Migrate filters to python3 + * Sat Jul 14 2018 Fedora Release Engineering - 1.3.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild