Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
1d3e79e57e
!39 Update to 1.4.2
From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-09-06 01:00:35 +00:00
wk333
add2cbf684 Update to 1.4.2 2023-09-05 17:26:31 +08:00
openeuler-ci-bot
47de0f0d55
!37 Fix test failure caused by python update to 3.11
From: @starlet-dx 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-08-07 01:11:39 +00:00
starlet-dx
75fc62ea54 Fix test failure caused by python update to 3.11 2023-08-04 18:04:23 +08:00
openeuler-ci-bot
896044bbd1
!33 python-testtools升级到2.5.0版本,导致subunit测试阶段报错
From: @starlet-dx 
Reviewed-by: @licihua 
Signed-off-by: @licihua
2022-07-07 12:48:07 +00:00
starlet-dx
3878956112 Resolve the compilation fails, due to python-testtools update to 2.5.0 2022-07-07 19:28:08 +08:00
openeuler-ci-bot
63bb6657d7 !11 Upgrade to 1.4.0 to support OpenStack-W
From: @huangtianhua
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-07-13 09:00:22 +00:00
huangtianhua
7f10bea380 Upgrade to 1.4.0 to support OpenStack-W
This upgrades to 1.4.0 and drops the patches
which have been upstreamed.
2021-07-13 08:11:35 +00:00
openeuler-ci-bot
eff65e0eb8 !7 清除python2残留并修复python3 Bug
From: @xiyuanwang
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-02-22 19:25:14 +08:00
wangxiyuan
0c58befa8d Fix issue 2021-02-22 17:40:19 +08:00
8 changed files with 54 additions and 541 deletions

View File

@ -1,239 +0,0 @@
From ad3523fd57d01c9a443e2d1b07215c001d8da91d Mon Sep 17 00:00:00 2001
From: Haikel Guemar <hguemar@fedoraproject.org>
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

View File

@ -1,36 +0,0 @@
From 4abf704d1baddda950450ad057c5f4be87804928 Mon Sep 17 00:00:00 2001
From: Quique Llorente <ellorent@redhat.com>
Date: Wed, 26 Dec 2018 14:57:24 +0100
Subject: [PATCH] Fix file open for python3
At python3 there is no "file" the "open" function has to be use to open
a file.
---
python/subunit/filters.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
index 0a0a185..ec7e9f3 100644
--- a/python/subunit/filters.py
+++ b/python/subunit/filters.py
@@ -5,7 +5,7 @@
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -143,7 +143,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward,
if output_path is None:
output_to = sys.stdout
else:
- output_to = file(output_path, 'wb')
+ output_to = open(output_path, 'w')
try:
result = result_factory(output_to)
--
2.19.2

View File

@ -1,122 +0,0 @@
From 50101aef9e200edeaa800a77c74cda5461850296 Mon Sep 17 00:00:00 2001
From: maminjie <maminjie1@huawei.com>
Date: Wed, 3 Feb 2021 11:40:42 +0800
Subject: [PATCH] port to python-iso8601 0.1.12
---
python/subunit/__init__.py | 2 +-
python/subunit/test_results.py | 2 +-
python/subunit/tests/test_test_protocol.py | 4 ++--
python/subunit/tests/test_test_protocol2.py | 4 ++--
python/subunit/tests/test_test_results.py | 4 ++--
python/subunit/v2.py | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index b3b198c..846cc31 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -799,7 +799,7 @@ class TestProtocolClient(testresult.TestResult):
":param datetime: A datetime.datetime object.
"""
- time = a_datetime.astimezone(iso8601.Utc())
+ time = a_datetime.astimezone(iso8601.UTC)
self._stream.write(_b("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
time.year, time.month, time.day, time.hour, time.minute,
time.second, time.microsecond)))
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 53c3dad..3cda44a 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -196,7 +196,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
time = self._time
if time is not None:
return
- time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
+ time = datetime.datetime.utcnow().replace(tzinfo=iso8601.UTC)
self.decorated.time(time)
def progress(self, offset, whence):
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index 7427b12..7692489 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -993,7 +993,7 @@ class TestTestProtocolServerStreamTime(unittest.TestCase):
self.assertEqual(_b(""), self.stream.getvalue())
self.assertEqual([
('time', datetime.datetime(2001, 12, 12, 12, 59, 59, 0,
- iso8601.Utc()))
+ iso8601.UTC))
], self.result._events)
@@ -1368,7 +1368,7 @@ class TestTestProtocolClient(TestCase):
def test_time(self):
# Calling time() outputs a time signal immediately.
self.protocol.time(
- datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc()))
+ datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC))
self.assertEqual(
_b("time: 2009-10-11 12:13:14.000015Z\n"),
self.io.getvalue())
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
index bbf510e..f970ed6 100644
--- a/python/subunit/tests/test_test_protocol2.py
+++ b/python/subunit/tests/test_test_protocol2.py
@@ -218,7 +218,7 @@ class TestStreamResultToBytes(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
result, output = self._make_result()
result.status(test_id="bar", test_status='success', timestamp=timestamp)
self.assertEqual(CONSTANT_TIMESTAMP, output.getvalue())
@@ -382,7 +382,7 @@ class TestByteStreamToStreamResult(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
self.check_event(CONSTANT_TIMESTAMP,
'success', test_id='bar', timestamp=timestamp)
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index 44f95b3..f1a83fd 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -178,7 +178,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
def test_calling_time_inhibits_automatic_time(self):
# Calling time() outputs a time signal immediately and prevents
# automatically adding one when other methods are called.
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.result.startTest(self)
self.result.stopTest(self)
@@ -186,7 +186,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
self.assertEqual(time, self.decorated._calls[0])
def test_calling_time_None_enables_automatic_time(self):
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.assertEqual(1, len(self.decorated._calls))
self.assertEqual(time, self.decorated._calls[0])
diff --git a/python/subunit/v2.py b/python/subunit/v2.py
index 254617c..be2049d 100644
--- a/python/subunit/v2.py
+++ b/python/subunit/v2.py
@@ -49,7 +49,7 @@ FLAG_TAGS = 0x0080
FLAG_MIME_TYPE = 0x0020
FLAG_EOF = 0x0010
FLAG_FILE_CONTENT = 0x0040
-EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.Utc())
+EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.UTC)
NUL_ELEMENT = b'\0'[0]
# Contains True for types for which 'nul in thing' falsely returns false.
_nul_test_broken = {}
--
2.23.0

Binary file not shown.

BIN
subunit-1.4.2.tar.gz Normal file

Binary file not shown.

View File

@ -1,26 +0,0 @@
From 2051f178d568a1595f497308703495b9e33ff80b Mon Sep 17 00:00:00 2001
From: Lukas Bezdicka <lbezdick@redhat.com>
Date: Wed, 2 Sep 2015 06:55:42 -0400
Subject: [PATCH] Correctly decode binary to utf8 string
This patch solves error:
Expecting a string b'2014-12-16 20:42:25.441886Z'
Related-Bug: #1403214
---
python/subunit/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 7d864e8..b198884 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -556,7 +556,7 @@ def _handleTags(self, offset, line):
def _handleTime(self, offset, line):
# Accept it, but do not do anything with it yet.
try:
- event_time = iso8601.parse_date(line[offset:-1])
+ event_time = iso8601.parse_date(line[offset:-1].decode('utf8'))
except TypeError:
raise TypeError(_u("Failed to parse %r, got %r")
% (line, sys.exec_info[1]))

View File

@ -1,45 +0,0 @@
--- COPYING.orig 2018-03-24 08:22:44.000000000 -0600
+++ COPYING 2018-07-03 15:07:50.241733503 -0600
@@ -29,8 +29,6 @@ Code that has been incorporated into Sub
naturally be under its own license, and will retain that license.
A known list of such code is maintained here:
-* The python/iso8601 module by Michael Twomey, distributed under an MIT style
- licence - see python/iso8601/LICENSE for details.
* The runtests.py and python/subunit/tests/TestUtil.py module are GPL test
support modules. They are not installed by Subunit - they are only ever
used on the build machine. Copyright 2004 Canonical Limited.
--- Makefile.am.orig 2018-03-24 08:22:44.000000000 -0600
+++ Makefile.am 2018-07-03 15:08:08.386499408 -0600
@@ -16,11 +16,6 @@ EXTRA_DIST = \
perl/lib/Subunit.pm \
perl/lib/Subunit/Diff.pm \
perl/subunit-diff \
- python/iso8601/LICENSE \
- python/iso8601/README \
- python/iso8601/README.subunit \
- python/iso8601/setup.py \
- python/iso8601/test_iso8601.py \
python/subunit/tests/__init__.py \
python/subunit/tests/sample-script.py \
python/subunit/tests/sample-two-script.py \
@@ -78,7 +73,6 @@ pkgpython_PYTHON = \
python/subunit/chunked.py \
python/subunit/details.py \
python/subunit/filters.py \
- python/subunit/iso8601.py \
python/subunit/progress_model.py \
python/subunit/run.py \
python/subunit/v2.py \
--- README.rst.orig 2018-03-24 08:22:44.000000000 -0600
+++ README.rst 2018-07-03 15:08:21.114335195 -0600
@@ -15,9 +15,6 @@
See the COPYING file for full details on the licensing of Subunit.
- subunit reuses iso8601 by Michael Twomey, distributed under an MIT style
- licence - see python/iso8601/LICENSE for details.
-
Subunit
-------

View File

@ -1,20 +1,24 @@
Name: subunit
Version: 1.3.0
Release: 14
Version: 1.4.2
Release: 1
Summary: C bindings for subunit
License: ASL 2.0 or BSD
License: Apache-2.0 OR BSD-3-Clause
URL: https://launchpad.net/subunit
Source0: https://launchpad.net/subunit/trunk/1.3/+download/subunit-%{version}.tar.gz
Patch0: %{name}-unbundle-iso8601.patch
Patch1: %{name}-decode-binary-to-unicode.patch
Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch
Patch3: 0002-Fix-file-open-for-python3.patch
Patch4: 0003-port-to-python-iso8601-0.1.12.patch
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
Source0: https://launchpad.net/subunit/trunk/%{version}/+download/%{name}-%{version}.tar.gz
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: pkgconfig
BuildRequires: pkgconfig(cppunit)
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python3-wheel
BuildRequires: python3-testtools >= 1.8.0
BuildRequires: python3-testscenarios
BuildRequires: pkgconfig(check)
%description
Subunit C bindings. See the python-subunit package for test processing
functionality.
@ -55,10 +59,11 @@ Subunit shell bindings. See the python-subunit package for test
processing functionality.
%package -n python3-%{name}
# The bundled iso8601 library is MIT licensed
License: (Apache-2.0 OR BSD-3-Clause) AND MIT
Summary: Streaming protocol for test results
BuildArch: noarch
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
%{?python_provide:%python_provide python3-%{name}}
Provides: bundled(python3-iso8601) = 0.1.4
%description -n python3-%{name}
Subunit is a streaming protocol for test results. The protocol is a
binary encoding that is easily generated and parsed. By design all the
@ -83,9 +88,7 @@ A number of useful things can be done easily with subunit:
Summary: Test code for the python 3 subunit bindings
BuildArch: noarch
Requires: python3-%{name} = %{version}-%{release} %{name}-filters = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}-test}
Obsoletes: python2-%{name}-test < 1.3.0-9
Provides: python2-%{name}-test = %{version}-%{release}
%description -n python3-%{name}-test
%{summary}.
@ -105,50 +108,22 @@ Subunit C bindings in a static library, for building statically linked
test cases.
%prep
%setup -qc
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%autosetup -n %{name}-%{version} -p1
fixtimestamp() {
touch -r $1.orig $1
rm $1.orig
}
for filt in filters/*; do
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
chmod 0755 ${filt}.new
touch -r $filt ${filt}.new
mv -f ${filt}.new $filt
done
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
-i Makefile.am
for fil in $(grep -Frl "%{_bindir}/env python"); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
sed -i.orig 's,%{_bindir}/env python3,%{_bindir}/python3,' $fil
fixtimestamp $fil
done
autoreconf -fi
cp -a ../%{name}-%{version} ../python3
mv ../python3 .
pushd python3
for fil in $(grep -Frl "%{_bindir}/python2"); do
sed -i.orig 's,\(%{_bindir}/python\)2,\13,' $fil
fixtimestamp $fil
done
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
popd
%build
export INSTALLDIRS=perl
%configure --enable-shared --enable-static
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
make %{?_smp_mflags}
pushd python3
export INSTALLDIRS=perl
# Build for python3
export PYTHON=%{_bindir}/python3
%configure --enable-shared --enable-static
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
@ -156,50 +131,39 @@ sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
make %{?_smp_mflags}
%py3_build
popd
%pyproject_build
%install
pushd python3
%py3_install
%pyproject_install
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
ln -f -s %{python3_sitelib}/iso8601/__pycache__/$fil \
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
done
popd
%make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p"
%make_install INSTALL="%{_bindir}/install -p"
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
rm -f %{buildroot}%{_libdir}/*.la
mkdir -p %{buildroot}%{perl_vendorlib}
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
rm -fr %{buildroot}%{perl_archlib}
chmod 0755 %{buildroot}%{_bindir}/subunit-diff
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/filter_scripts/*.py
chmod 0644 %{buildroot}%{python3_sitelib}/%{name}/filter_scripts/__init__.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h
touch -r c++/SubunitTestProgressListener.h \
%{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h
touch -r perl/subunit-diff %{buildroot}%{_bindir}/subunit-diff
for fil in filters/*; do
touch -r $fil %{buildroot}%{_bindir}/$(basename $fil)
done
%check
pushd python3
export LD_LIBRARY_PATH=$PWD/.libs
export PYTHON=%{__python3}
make check
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
popd
%ldconfig_scriptlets
%ldconfig_scriptlets cppunit
%files
%doc NEWS README.rst
@ -235,7 +199,7 @@ popd
%files -n python3-%{name}
%license Apache-2.0 BSD COPYING
%{python3_sitelib}/%{name}/
%{python3_sitelib}/python_%{name}-%{version}-*.egg-info
%{python3_sitelib}/python_%{name}-%{version}.dist-info/
%exclude %{python3_sitelib}/%{name}/tests/
%files -n python3-%{name}-test
@ -249,6 +213,23 @@ popd
%exclude %{_bindir}/%{name}-diff
%changelog
* Tue Sep 05 2023 wangkai <13474090681@163.com> - 1.4.2-1
- Update to 1.4.2
- Use pyproject to compile package
- Modify iso8601 to bundle
* Fri Aug 04 2023 yaoxin <yao_xin001@hoperun.com> - 1.4.0-3
- Fix test failure caused by python update to 3.11
* Thu Jul 07 2022 yaoxin <yaoxin30@h-partners.com> - 1.4.0-2
- Resolve the compilation fails, due to python-testtools update to 2.5.0
* Mon Jul 12 2021 huangtianhua <huangtianhua@huawei.com> - 1.4.0-1
- Upgrade to 1.4.0 and drop the patches which have been upstreamed
* Mon Feb 22 2021 wangxiyuan <wangxiyuan1007@gmail.com> - 1.3.0-15
- CleanUp python2 residual content and backport a python3 known issue.
* Wed Feb 03 2021 maminjie <maminjie1@huawei.com> - 1.3.0-14
- Port to python-iso8601 0.1.12