[packages/python3-xmlschema] - python-xmlschema.spec updated to 1.2.4 for python 3.5+ - added remote-tests patch (add option to d

qboosh qboosh at pld-linux.org
Fri Sep 18 21:40:15 CEST 2020


commit 4c64e9e26bfce8fcabba5ab72616774b590da770
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Sep 18 21:43:04 2020 +0200

    - python-xmlschema.spec updated to 1.2.4 for python 3.5+
    - added remote-tests patch (add option to disable network tests by environment variable)

 python3-xmlschema-remote-tests.patch            | 19 ++++++
 python-xmlschema.spec => python3-xmlschema.spec | 79 +++++--------------------
 2 files changed, 35 insertions(+), 63 deletions(-)
---
diff --git a/python-xmlschema.spec b/python3-xmlschema.spec
similarity index 53%
rename from python-xmlschema.spec
rename to python3-xmlschema.spec
index 2083c39..754a44e 100644
--- a/python-xmlschema.spec
+++ b/python3-xmlschema.spec
@@ -2,31 +2,25 @@
 # Conditional build:
 %bcond_without	doc	# Sphinx documentation
 %bcond_without	tests	# unit tests
-%bcond_without	python2 # CPython 2.x module
-%bcond_without	python3 # CPython 3.x module
 
 Summary:	XML Schema validator and decoder
 Summary(pl.UTF-8):	Biblioteka do sprawdzania poprawności i dekodowania schematów XML
-Name:		python-xmlschema
-Version:	1.0.18
+Name:		python3-xmlschema
+Version:	1.2.4
 Release:	1
 License:	MIT
 Group:		Libraries/Python
 #Source0Download: https://pypi.org/simple/xmlschema/
 Source0:	https://files.pythonhosted.org/packages/source/x/xmlschema/xmlschema-%{version}.tar.gz
-# Source0-md5:	f3e7f9002aeb9846af68f81c6ec82200
+# Source0-md5:	841bd178f6c27884a801ab0b1245e571
+Patch0:		%{name}-remote-tests.patch
 URL:		https://pypi.org/project/xmlschema/
-%if %{with python2}
-BuildRequires:	python-elementpath >= 1.3.0
-BuildRequires:	python-elementpath < 1.4.0
-BuildRequires:	python-modules >= 1:2.7
-BuildRequires:	python-setuptools
-%endif
-%if %{with python3}
-BuildRequires:	python3-elementpath >= 1.3.0
-BuildRequires:	python3-elementpath < 1.4.0
+BuildRequires:	python3-elementpath >= 2.0.2
+BuildRequires:	python3-elementpath < 3.0.0
 BuildRequires:	python3-modules >= 1:3.5
 BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-lxml
 %endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
@@ -35,7 +29,7 @@ BuildRequires:	sed >= 4.0
 BuildRequires:	python3-sphinx_rtd_theme
 BuildRequires:	sphinx-pdg-3
 %endif
-Requires:	python-modules >= 1:2.7
+Requires:	python3-modules >= 1:3.5
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -47,20 +41,6 @@ The xmlschema library is an implementation of XML Schema
 Biblioteka xmlschema to implementacja XML Schema
 (<http://www.w3.org/2001/XMLSchema>) dla Pythona.
 
-%package -n python3-xmlschema
-Summary:	XML Schema validator and decoder
-Summary(pl.UTF-8):	Biblioteka do sprawdzania poprawności i dekodowania schematów XML
-Group:		Libraries/Python
-Requires:	python3-modules >= 1:3.5
-
-%description -n python3-xmlschema
-The xmlschema library is an implementation of XML Schema
-(<http://www.w3.org/2001/XMLSchema>) for Python.
-
-%description -n python3-xmlschema -l pl.UTF-8
-Biblioteka xmlschema to implementacja XML Schema
-(<http://www.w3.org/2001/XMLSchema>) dla Pythona.
-
 %package apidocs
 Summary:	API documentation for Python xmlschema module
 Summary(pl.UTF-8):	Dokumentacja API modułu Pythona xmlschema
@@ -74,26 +54,17 @@ Dokumentacja API modułu Pythona xmlschema.
 
 %prep
 %setup -q -n xmlschema-%{version}
+%patch0 -p1
 
-%{__sed} -i -e 's/^SKIP_REMOTE_TESTS =.*/SKIP_REMOTE_TESTS = True/' xmlschema/tests/__init__.py
+%{__sed} -i -e '1s,/usr/bin/env python,%{__python3},' tests/check_{etree_import,memory}.py
 
 %build
-%if %{with python2}
-%py_build
-
-%if %{with tests}
-PYTHONPATH=$(pwd) \
-%{__python} xmlschema/tests/test_all.py
-%endif
-%endif
-
-%if %{with python3}
 %py3_build
 
 %if %{with tests}
+XMLSCHEMA_SKIP_REMOTE_TESTS=1 \
 PYTHONPATH=$(pwd) \
-%{__python3} xmlschema/tests/test_all.py
-%endif
+%{__python3} -m unittest
 %endif
 
 %if %{with doc}
@@ -104,37 +75,19 @@ PYTHONPATH=$(pwd) \
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%if %{with python2}
-%py_install
-
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/xmlschema/tests
-%py_postclean
-%endif
-
-%if %{with python3}
 %py3_install
 
-%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/xmlschema/tests
-%endif
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%if %{with python2}
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG.rst LICENSE README.rst
-%{py_sitescriptdir}/xmlschema
-%{py_sitescriptdir}/xmlschema-%{version}-py*.egg-info
-%endif
-
-%if %{with python3}
-%files -n python3-xmlschema
-%defattr(644,root,root,755)
-%doc CHANGELOG.rst LICENSE README.rst
+%attr(755,root,root) %{_bindir}/xmlschema-json2xml
+%attr(755,root,root) %{_bindir}/xmlschema-validate
+%attr(755,root,root) %{_bindir}/xmlschema-xml2json
 %{py3_sitescriptdir}/xmlschema
 %{py3_sitescriptdir}/xmlschema-%{version}-py*.egg-info
-%endif
 
 %if %{with doc}
 %files apidocs
diff --git a/python3-xmlschema-remote-tests.patch b/python3-xmlschema-remote-tests.patch
new file mode 100644
index 0000000..2ec5c50
--- /dev/null
+++ b/python3-xmlschema-remote-tests.patch
@@ -0,0 +1,19 @@
+--- xmlschema-1.2.4/xmlschema/testing/__init__.py.orig	2020-03-19 16:13:12.000000000 +0100
++++ xmlschema-1.2.4/xmlschema/testing/__init__.py	2020-09-18 21:08:20.536024723 +0200
+@@ -17,6 +17,7 @@
+ build a set of test classes. Each path is followed by a list of options that defines a
+ custom setting for each test.
+ """
++import os
+ import platform
+ from urllib.request import urlopen
+ from urllib.error import URLError
+@@ -41,7 +42,7 @@
+     return False
+ 
+ 
+-SKIP_REMOTE_TESTS = not has_network_access(
++SKIP_REMOTE_TESTS = os.environ.get("XMLSCHEMA_SKIP_REMOTE_TESTS", 0) or not has_network_access(
+     'https://github.com/', 'https://www.w3.org/', 'https://www.sissa.it/'
+ )
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-xmlschema.git/commitdiff/4c64e9e26bfce8fcabba5ab72616774b590da770



More information about the pld-cvs-commit mailing list