[packages/python-jsonschema] - updated to 3.2.0 - added webcolors patch from git (webcolors 1.11 compatibility)

qboosh qboosh at pld-linux.org
Tue Apr 14 06:25:32 CEST 2020


commit 39795331310ac3a5468b3f9da373cfeb28780d66
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Apr 14 06:25:34 2020 +0200

    - updated to 3.2.0
    - added webcolors patch from git (webcolors 1.11 compatibility)

 python-jsonschema-webcolors.patch | 100 ++++++++++++++++++++++++++++++++++++++
 python-jsonschema.spec            |  88 +++++++++++++++++++++------------
 2 files changed, 157 insertions(+), 31 deletions(-)
---
diff --git a/python-jsonschema.spec b/python-jsonschema.spec
index 08ae8ed..3a176a3 100644
--- a/python-jsonschema.spec
+++ b/python-jsonschema.spec
@@ -1,6 +1,7 @@
 #
 # Conditional build:
-%bcond_without	tests	# nose tests
+%bcond_without	doc	# Sphinx documentation
+%bcond_without	tests	# unit tests
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
 
@@ -8,53 +9,74 @@
 Summary:	An implementation of JSON Schema validation for Python 2
 Summary(pl.UTF-8):	Implementacja sprawdzania poprawności schematu JSON dla Pythona 2
 Name:		python-%{module}
-Version:	2.6.0
-Release:	4
+Version:	3.2.0
+Release:	1
 License:	MIT
 Group:		Libraries/Python
 #Source0Download: https://pypi.python.org/simple/jsonschema/
 Source0:	https://files.pythonhosted.org/packages/source/j/jsonschema/%{module}-%{version}.tar.gz
-# Source0-md5:	50c6b69a373a8b55ff1e0ec6e78f13f4
+# Source0-md5:	f1a0b5011f05a02a8dee1070cd10a26d
+Patch0:		%{name}-webcolors.patch
 URL:		https://pypi.python.org/pypi/jsonschema
 %if %{with python2}
 BuildRequires:	python-functools32
 BuildRequires:	python-modules >= 1:2.7
 BuildRequires:	python-setuptools
+BuildRequires:	python-setuptools_scm
 BuildRequires:	python-vcversioner >= 2.16.0.0
 %if %{with tests}
-BuildRequires:	python-mock
-BuildRequires:	python-nose
+BuildRequires:	python-attrs >= 17.4.0
+BuildRequires:	python-idna
+BuildRequires:	python-importlib_metadata
+BuildRequires:	python-jsonpointer >= 1.14
+BuildRequires:	python-pyrsistent >= 0.14.0
 BuildRequires:	python-rfc3987
-# optional, but tests fail if python-isodate is installed and strict_rfc3339 isn't
+BuildRequires:	python-six >= 1.11.0
 BuildRequires:	python-strict_rfc3339
+BuildRequires:	python-twisted
 BuildRequires:	python-webcolors
 %endif
 %endif
 %if %{with python3}
 BuildRequires:	python3-modules >= 1:3.5
 BuildRequires:	python3-setuptools
+BuildRequires:	python3-setuptools_scm
 BuildRequires:	python3-vcversioner >= 2.16.0.0
 %if %{with tests}
-BuildRequires:	python3-nose
+BuildRequires:	python3-attrs >= 17.4.0
+BuildRequires:	python3-idna
+%if "%{py3_ver}" < "3.8"
+BuildRequires:	python-importlib_metadata
+%endif
+BuildRequires:	python3-jsonpointer >= 1.14
+BuildRequires:	python3-pyrsistent >= 0.14.0
 BuildRequires:	python3-rfc3987
+BuildRequires:	python3-six >= 1.11.0
 # optional, but tests fail if python3-isodate is installed and strict_rfc3339 isn't
 BuildRequires:	python3-strict_rfc3339
+BuildRequires:	python3-twisted
 BuildRequires:	python3-webcolors
 %endif
 %endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires:	sphinx-pdg-3
+BuildRequires:	python3-certifi
+BuildRequires:	python3-lxml
+BuildRequires:	python3-sphinxcontrib-spelling
+%endif
 Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
-jsonschema is JSON Schema validator currently based on
-<http://tools.ietf.org/html/draft-zyp-json-schema-03>.
+jsonschema is an implementation of JSON Schema
+(<https://json-schema.org/>) for Python.
 
 %description -l pl.UTF-8
-jsonschema to walidator schematów JSON oparty na dokumencie
-<http://tools.ietf.org/html/draft-zyp-json-schema-03>.
+jsonschema to implementacja JSON Schema (<https://json-schema.org/>)
+dla Pythona.
 
 %package -n python3-%{module}
 Summary:	An implementation of JSON Schema validation for Python 3
@@ -63,22 +85,24 @@ Group:		Libraries/Python
 Requires:	python3-modules >= 1:3.5
 
 %description -n python3-%{module}
-jsonschema is JSON Schema validator currently based on
-<http://tools.ietf.org/html/draft-zyp-json-schema-03>.
+jsonschema is an implementation of JSON Schema
+(<https://json-schema.org/>) for Python.
 
 %description -n python3-%{module} -l pl.UTF-8
-jsonschema to walidator schematów JSON oparty na dokumencie
-<http://tools.ietf.org/html/draft-zyp-json-schema-03>.
+jsonschema to implementacja JSON Schema (<https://json-schema.org/>)
+dla Pythona.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
 %py_build
 
 %if %{with tests}
-%{_bindir}/nosetests-%{py_ver} -v
+PYTHONPATH=$(pwd) \
+trial-2 jsonschema
 %endif
 %endif
 
@@ -86,31 +110,33 @@ jsonschema to walidator schematów JSON oparty na dokumencie
 %py3_build
 
 %if %{with tests}
-%{_bindir}/nosetests-%{py3_ver} -v
+PYTHONPATH=$(pwd) \
+trial-3 jsonschema
 %endif
 %endif
 
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+%{__make} -C docs html \
+	PYTHON="%{__python3}"
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%if %{with python3}
-%py3_install
-
-%{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-3}
-
-# pythonegg dependency generator resolves conditionals for requires() based on
-# python version that runs the generator, not the version egg is targeted;
-# avoid generation of python3egg(functools32) dependency for python 3
-%{__sed} -i -e "/^\\[:python_version=='2.7']/,/^$/d" $RPM_BUILD_ROOT%{py3_sitescriptdir}/jsonschema-%{version}-py*.egg-info/requires.txt
-%endif
-
 %if %{with python2}
 %py_install
 
 %py_postclean
 
 %{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-2}
-ln -sf jsonschema-2 $RPM_BUILD_ROOT%{_bindir}/jsonschema
+%endif
+
+%if %{with python3}
+%py3_install
+
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-3}
+ln -sf jsonschema-3 $RPM_BUILD_ROOT%{_bindir}/jsonschema
 %endif
 
 %clean
@@ -120,7 +146,6 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG.rst COPYING README.rst
-%attr(755,root,root) %{_bindir}/jsonschema
 %attr(755,root,root) %{_bindir}/jsonschema-2
 %{py_sitescriptdir}/jsonschema
 %{py_sitescriptdir}/jsonschema-%{version}-py*.egg-info
@@ -130,6 +155,7 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python3-%{module}
 %defattr(644,root,root,755)
 %doc CHANGELOG.rst COPYING README.rst
+%attr(755,root,root) %{_bindir}/jsonschema
 %attr(755,root,root) %{_bindir}/jsonschema-3
 %{py3_sitescriptdir}/jsonschema
 %{py3_sitescriptdir}/jsonschema-%{version}-py*.egg-info
diff --git a/python-jsonschema-webcolors.patch b/python-jsonschema-webcolors.patch
new file mode 100644
index 0000000..944f2f0
--- /dev/null
+++ b/python-jsonschema-webcolors.patch
@@ -0,0 +1,100 @@
+From 09595a50f507399bf3fa8c68ed6371c42b9c4874 Mon Sep 17 00:00:00 2001
+From: Julian Berman <Julian at GrayVines.com>
+Date: Fri, 21 Feb 2020 09:30:05 -0500
+Subject: [PATCH] Newer webcolors has a new API apparently.
+
+---
+ jsonschema/_format.py | 2 +-
+ setup.cfg             | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/jsonschema/_format.py b/jsonschema/_format.py
+index 281a7cfc..f3c758c4 100644
+--- a/jsonschema/_format.py
++++ b/jsonschema/_format.py
+@@ -354,7 +354,7 @@ def is_css_color_code(instance):
+     def is_css21_color(instance):
+         if (
+             not isinstance(instance, str_types) or
+-            instance.lower() in webcolors.css21_names_to_hex
++            instance.lower() in webcolors.CSS21_NAMES_TO_HEX
+         ):
+             return True
+         return is_css_color_code(instance)
+#diff --git a/setup.cfg b/setup.cfg
+#index 250c15be..a75c1150 100644
+#--- a/setup.cfg
+#+++ b/setup.cfg
+#@@ -40,11 +40,11 @@ format =
+#     jsonpointer>1.13
+#     rfc3987
+#     strict-rfc3339
+#-    webcolors
+#+    webcolors>=1.11.1
+# format_nongpl =
+#     idna
+#     jsonpointer>1.13
+#-    webcolors
+#+    webcolors>=1.11.1
+#     rfc3986-validator>0.1.0
+#     rfc3339-validator
+# 
+From 0d192e192526252c30c16b3651c293bb5f21a99f Mon Sep 17 00:00:00 2001
+From: Julian Berman <Julian at GrayVines.com>
+Date: Fri, 21 Feb 2020 09:56:13 -0500
+Subject: [PATCH] Sigh... but also drops Py2 compat.
+
+---
+ jsonschema/_format.py | 11 ++++++++---
+ setup.cfg             |  4 ++--
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/jsonschema/_format.py b/jsonschema/_format.py
+index f3c758c4..b96efb69 100644
+--- a/jsonschema/_format.py
++++ b/jsonschema/_format.py
+@@ -342,10 +342,15 @@ def is_draft3_time(instance):
+     return datetime.datetime.strptime(instance, "%H:%M:%S")
+ 
+ 
+-try:
++try:  # webcolors>=1.11
++    from webcolors import CSS21_NAMES_TO_HEX
+     import webcolors
+ except ImportError:
+-    pass
++    try:  # webcolors<1.11
++        from webcolors import css21_names_to_hex as CSS21_NAMES_TO_HEX
++        import webcolors
++    except ImportError:
++        pass
+ else:
+     def is_css_color_code(instance):
+         return webcolors.normalize_hex(instance)
+@@ -354,7 +359,7 @@ def is_css_color_code(instance):
+     def is_css21_color(instance):
+         if (
+             not isinstance(instance, str_types) or
+-            instance.lower() in webcolors.CSS21_NAMES_TO_HEX
++            instance.lower() in CSS21_NAMES_TO_HEX
+         ):
+             return True
+         return is_css_color_code(instance)
+#diff --git a/setup.cfg b/setup.cfg
+#index a75c1150..250c15be 100644
+#--- a/setup.cfg
+#+++ b/setup.cfg
+#@@ -40,11 +40,11 @@ format =
+#     jsonpointer>1.13
+#     rfc3987
+#     strict-rfc3339
+#-    webcolors>=1.11.1
+#+    webcolors
+# format_nongpl =
+#     idna
+#     jsonpointer>1.13
+#-    webcolors>=1.11.1
+#+    webcolors
+#     rfc3986-validator>0.1.0
+#     rfc3339-validator
+# 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-jsonschema.git/commitdiff/39795331310ac3a5468b3f9da373cfeb28780d66



More information about the pld-cvs-commit mailing list