[packages/python-dtopt] - added python3 fixes, release 14
qboosh
qboosh at pld-linux.org
Sat Oct 28 23:17:40 CEST 2023
commit 19b584051b8c4857a095dbf407fdf3d799b95f4f
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Oct 28 22:15:09 2023 +0200
- added python3 fixes, release 14
dtopt-py3.patch | 23 +++++++++++++++++++++++
python-dtopt.spec | 14 ++++++++------
2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/python-dtopt.spec b/python-dtopt.spec
index f3b6977..c65ce7e 100644
--- a/python-dtopt.spec
+++ b/python-dtopt.spec
@@ -9,12 +9,13 @@ Summary: Add options to doctest examples while they are running
Summary(pl.UTF-8): Dodawanie opcji do przykładów doctest w trakcie ich działania
Name: python-%{module}
Version: 0.1
-Release: 13
+Release: 14
License: MIT
Group: Libraries/Python
#Source0Download: https://pypi.org/simple/dtopt/
Source0: https://files.pythonhosted.org/packages/source/d/dtopt/dtopt-%{version}.tar.gz
# Source0-md5: 9a41317149e926fcc408086aedee6bab
+Patch0: dtopt-py3.patch
URL: https://pypi.org/project/dtopt/
%if %{with python2}
BuildRequires: python-setuptools
@@ -74,6 +75,7 @@ poprzez:
%prep
%setup -q -n %{module}-%{version}
+%patch0 -p1
# Remove bundled egg info
%{__rm} -r *.egg-info
@@ -84,15 +86,16 @@ poprzez:
%if %{with tests}
PYTHONPATH=$(pwd) \
-%{__python} dtopt/tests.py
+%{__python} dtopt/tests.py 2>&1 | tee tests.log
+# "one error is good"
+grep -q ' 1 failures' tests.log
%endif
%endif
%if %{with python3}
%py3_build
-%if 0 && %{with tests}
-# as of 0.1, uses python2 syntax
+%if %{with tests}
PYTHONPATH=$(pwd) \
%{__python3} dtopt/tests.py 2>&1 | tee tests.log
# "one error is good"
@@ -114,8 +117,7 @@ rm -rf $RPM_BUILD_ROOT
%py3_install
%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/tests.py
-# probably won't be compiled due to python2 syntax
-rm -f $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/__pycache__/tests.cpython-*.py*
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/dtopt/__pycache__/tests.cpython-*.py*
%endif
%clean
diff --git a/dtopt-py3.patch b/dtopt-py3.patch
new file mode 100644
index 0000000..9de77a5
--- /dev/null
+++ b/dtopt-py3.patch
@@ -0,0 +1,23 @@
+--- dtopt-0.1/dtopt/tests.py.orig 2007-08-10 20:24:37.000000000 +0200
++++ dtopt-0.1/dtopt/tests.py 2023-10-28 21:55:30.314817194 +0200
+@@ -19,6 +19,6 @@ See, you got an error! Next:
+ if __name__ == '__main__':
+ import doctest
+ doctest.testmod()
+- print 'Expect *one* error. Zero is bad, two is bad.'
+- print 'One error is good'
++ print('Expect *one* error. Zero is bad, two is bad.')
++ print('One error is good')
+
+--- dtopt-0.1/dtopt/__init__.py.orig 2007-08-10 20:24:37.000000000 +0200
++++ dtopt-0.1/dtopt/__init__.py 2023-10-28 22:09:20.953650571 +0200
+@@ -1,6 +1,9 @@
+ import doctest
+ import sys
+
++if sys.version_info[0] == 3:
++ basestring = str
++
+ def install_option(option, after_unload=None):
+ if isinstance(option, basestring):
+ if option not in doctest.OPTIONFLAGS_BY_NAME:
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-dtopt.git/commitdiff/19b584051b8c4857a095dbf407fdf3d799b95f4f
More information about the pld-cvs-commit
mailing list