[packages/python-pyclipper] - new - tests patch to fix test failure on python2

qboosh qboosh at pld-linux.org
Sat Dec 18 18:12:59 CET 2021


commit d814dcb650931c35bf7c985c7014695982774f32
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Dec 18 18:13:33 2021 +0100

    - new
    - tests patch to fix test failure on python2

 python-pyclipper-tests.patch |  22 +++++++
 python-pyclipper.spec        | 139 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 161 insertions(+)
---
diff --git a/python-pyclipper.spec b/python-pyclipper.spec
new file mode 100644
index 0000000..a7d751b
--- /dev/null
+++ b/python-pyclipper.spec
@@ -0,0 +1,139 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	Cython wrapper for Clipper library
+Summary(pl.UTF-8):	Cythonowe obudowanie biblioteki Clipper
+Name:		python-pyclipper
+Version:	1.3.0.post2
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/pyclipper/
+Source0:	https://files.pythonhosted.org/packages/source/p/pyclipper/pyclipper-%{version}.tar.gz
+# Source0-md5:	ac53748592d18d8c8b63b5bd65a2ab28
+Patch0:		%{name}-tests.patch
+URL:		https://pypi.org/project/pyclipper/
+BuildRequires:	libstdc++-devel
+%if %{with python2}
+BuildRequires:	python-Cython >= 0.28
+BuildRequires:	python-devel >= 1:2.7
+BuildRequires:	python-setuptools
+BuildRequires:	python-setuptools_scm >= 1.11.1
+%if %{with tests}
+BuildRequires:	python-pytest
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-Cython >= 0.28
+BuildRequires:	python3-devel >= 1:3.4
+BuildRequires:	python3-setuptools
+BuildRequires:	python3-setuptools_scm >= 1.11.1
+%if %{with tests}
+BuildRequires:	python3-pytest
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.7
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Pyclipper is a Cython wrapper exposing public functions and classes of
+the C++ translation of the Angus Johnson's Clipper library.
+
+The Clipper library performs line & polygon clipping - intersection,
+union, difference & exclusive-or, and line & polygon offsetting. The
+library is based on Vatti's clipping algorithm.
+
+%description -l pl.UTF-8
+Pyclipper to cythonowe obudowanie udostępniające funkcje i klasy
+publiczne tłumaczenia C++ biblioteki Clipper Angusa Johnsona.
+
+Biblioteka Clipper wykonuje obcinanie linii i wielokątów (wyznaczanie
+części wspólnej, sumy, różnicy i różnicy symetrycznej) oraz
+obrysowywanie linii i wielokątów. Jest oparta na algorytmie obcinania
+Vattiego.
+
+%package -n python3-pyclipper
+Summary:	Cython wrapper for Clipper library
+Summary(pl.UTF-8):	Cythonowe obudowanie biblioteki Clipper
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.4
+
+%description -n python3-pyclipper
+Pyclipper is a Cython wrapper exposing public functions and classes of
+the C++ translation of the Angus Johnson's Clipper library.
+
+%description -n python3-pyclipper -l pl.UTF-8
+Pyclipper to cythonowe obudowanie udostępniające funkcje i klasy
+publiczne tłumaczenia C++ biblioteki Clipper Angusa Johnsona.
+
+Biblioteka Clipper wykonuje obcinanie linii i wielokątów (wyznaczanie
+części wspólnej, sumy, różnicy i różnicy symetrycznej) oraz
+obrysowywanie linii i wielokątów. Jest oparta na algorytmie obcinania
+Vattiego.
+
+%prep
+%setup -q -n pyclipper-%{version}
+%patch0 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(echo $(pwd)/build-2/lib.*) \
+%{__python} -m pytest tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(echo $(pwd)/build-3/lib.*) \
+%{__python3} -m pytest tests
+%endif
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%dir %{py_sitedir}/pyclipper
+%{py_sitedir}/pyclipper/*.py[co]
+%attr(755,root,root) %{py_sitedir}/pyclipper/*.so
+%{py_sitedir}/pyclipper-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-pyclipper
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%dir %{py3_sitedir}/pyclipper
+%{py3_sitedir}/pyclipper/*.py
+%attr(755,root,root) %{py3_sitedir}/pyclipper/*.so
+%{py3_sitedir}/pyclipper/__pycache__
+%{py3_sitedir}/pyclipper-%{version}-py*.egg-info
+%endif
diff --git a/python-pyclipper-tests.patch b/python-pyclipper-tests.patch
new file mode 100644
index 0000000..d74ebcd
--- /dev/null
+++ b/python-pyclipper-tests.patch
@@ -0,0 +1,22 @@
+--- pyclipper-1.3.0.post2/tests/test_pyclipper.py.orig	2021-12-01 15:37:19.000000000 +0100
++++ pyclipper-1.3.0.post2/tests/test_pyclipper.py	2021-12-18 18:11:39.197462627 +0100
+@@ -12,8 +12,10 @@ import sys
+ 
+ if sys.version_info < (3,):
+     integer_types = (int, long)
++    u_type = unicode
+ else:
+     integer_types = (int,)
++    u_type = str
+ 
+ import pyclipper
+ 
+@@ -381,7 +383,7 @@ class TestNonStandardNumbers(TestCase):
+ class TestPackageVersion(TestCase):
+     def test__version__(self):
+         assert hasattr(pyclipper, "__version__")
+-        assert isinstance(pyclipper.__version__, str)
++        assert isinstance(pyclipper.__version__, u_type)
+ 
+ 
+ def _do_solutions_match(paths_1, paths_2, factor=None):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pyclipper.git/commitdiff/d814dcb650931c35bf7c985c7014695982774f32



More information about the pld-cvs-commit mailing list