[packages/python-cbor2] - new

qboosh qboosh at pld-linux.org
Sun May 19 12:54:56 CEST 2024


commit bf58754e46b7369df2dc70871c61c81082e87902
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun May 19 12:55:23 2024 +0200

    - new

 cbor2-py2.patch   |  49 +++++++++++++++++
 python-cbor2.spec | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 202 insertions(+)
---
diff --git a/python-cbor2.spec b/python-cbor2.spec
new file mode 100644
index 0000000..75a9d08
--- /dev/null
+++ b/python-cbor2.spec
@@ -0,0 +1,153 @@
+#
+# 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:	CBOR (de)serializer with extensive tag support
+Summary(pl.UTF-8):	(De)serializer CBOR z obszerną obsługą znaczników
+Name:		python-cbor2
+# keep 5.2.x here for python2 support
+Version:	5.2.0.post1
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/cbor2/
+Source0:	https://files.pythonhosted.org/packages/source/c/cbor2/cbor2-%{version}.tar.gz
+# Source0-md5:	57f0838f52864ce628621da0498f58f4
+Patch0:		cbor2-py2.patch
+URL:		https://pypi.org/project/cbor2/
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.7
+BuildRequires:	python-setuptools >= 1:40.7.0
+BuildRequires:	python-setuptools_scm >= 1.7.0
+%if %{with tests}
+BuildRequires:	python-pytest
+BuildRequires:	python-pytest-cov
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.5
+BuildRequires:	python3-setuptools >= 1:40.7.0
+BuildRequires:	python3-setuptools_scm >= 1.7.0
+BuildRequires:	python3-setuptools_scm < 6
+%if %{with tests}
+BuildRequires:	python3-pytest
+BuildRequires:	python3-pytest-cov
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires:	python-sphinx_rtd_theme
+BuildRequires:	sphinx-pdg-2
+%endif
+Requires:	python-modules >= 1:2.7
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This library provides encoding and decoding for the Concise Binary
+Object Representation (CBOR, RFC 7049) serialization format.
+
+%description -l pl.UTF-8
+Ta biblioteka zapewnia kodowanie i dekodowanie formatu serializacji
+CBOR (Concise Binary Object Representation, RFC 7049).
+
+%package -n python3-cbor2
+Summary:	CBOR (de)serializer with extensive tag support
+Summary(pl.UTF-8):	(De)serializer CBOR z obszerną obsługą znaczników
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.5
+
+%description -n python3-cbor2
+This library provides encoding and decoding for the Concise Binary
+Object Representation (CBOR, RFC 7049) serialization format.
+
+%description -n python3-cbor2 -l pl.UTF-8
+Ta biblioteka zapewnia kodowanie i dekodowanie formatu serializacji
+CBOR (Concise Binary Object Representation, RFC 7049).
+
+%package apidocs
+Summary:	API documentation for Python cbor2 module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona cbor2
+Group:		Documentation
+
+%description apidocs
+API documentation for Python cbor2 module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona cbor2.
+
+%prep
+%setup -q -n cbor2-%{version}
+%patch0 -p1
+
+%build
+# not supported for python2
+export CBOR2_BUILD_C_EXTENSION=0
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS="pytest_cov.plugin" \
+%{__python} -m pytest tests -k 'not test_huge'
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS="pytest_cov.plugin" \
+%{__python3} -m pytest tests -k 'not test_huge_truncated_bytes and not test_huge_truncated_string'
+%endif
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+sphinx-build-2 docs docs/_build/html
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+export CBOR2_BUILD_C_EXTENSION=0
+
+%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.txt README.rst
+%{py_sitescriptdir}/cbor2
+%{py_sitescriptdir}/cbor2-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-cbor2
+%defattr(644,root,root,755)
+%doc LICENSE.txt README.rst
+%{py3_sitescriptdir}/cbor2
+%{py3_sitescriptdir}/cbor2-%{version}-py*.egg-info
+%endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_static,modules,*.html,*.js}
+%endif
diff --git a/cbor2-py2.patch b/cbor2-py2.patch
new file mode 100644
index 0000000..e1714c4
--- /dev/null
+++ b/cbor2-py2.patch
@@ -0,0 +1,49 @@
+--- cbor2-5.2.0.post1/tests/test_decoder.py.orig	2021-12-22 23:33:04.000000000 +0100
++++ cbor2-5.2.0.post1/tests/test_decoder.py	2024-05-19 12:10:34.423331549 +0200
+@@ -430,8 +430,8 @@ def test_uuid(impl):
+ 
+ @pytest.mark.skipif(sys.version_info < (3, 3), reason="Address decoding requires Py3.3+")
+ @pytest.mark.parametrize('payload, expected', [
+-    ('d9010444c00a0a01', ip_address('192.10.10.1')),
+-    ('d901045020010db885a3000000008a2e03707334', ip_address('2001:db8:85a3::8a2e:370:7334')),
++    ('d9010444c00a0a01', ip_address(u'192.10.10.1')),
++    ('d901045020010db885a3000000008a2e03707334', ip_address(u'2001:db8:85a3::8a2e:370:7334')),
+     ('d9010446010203040506', (260, b'\x01\x02\x03\x04\x05\x06')),
+ ], ids=[
+     'ipv4',
+@@ -459,9 +459,9 @@ def test_bad_ipaddress(impl):
+ 
+ @pytest.mark.skipif(sys.version_info < (3, 5), reason="Network decoding requires Py3.5+")
+ @pytest.mark.parametrize('payload, expected', [
+-    ('d90105a144c0a800641818', ip_network('192.168.0.100/24', False)),
++    ('d90105a144c0a800641818', ip_network(u'192.168.0.100/24', False)),
+     ('d90105a15020010db885a3000000008a2e000000001860',
+-     ip_network('2001:db8:85a3:0:0:8a2e::/96', False)),
++     ip_network(u'2001:db8:85a3:0:0:8a2e::/96', False)),
+ ], ids=[
+     'ipv4',
+     'ipv6',
+--- cbor2-5.2.0.post1/tests/test_encoder.py.orig	2021-12-22 23:33:04.000000000 +0100
++++ cbor2-5.2.0.post1/tests/test_encoder.py	2024-05-19 12:11:16.003106292 +0200
+@@ -302,8 +302,8 @@ def test_uuid(impl):
+ 
+ @pytest.mark.skipif(sys.version_info < (3, 3), reason="Address encoding requires Py3.3+")
+ @pytest.mark.parametrize('value, expected', [
+-    (ip_address('192.10.10.1'), 'd9010444c00a0a01'),
+-    (ip_address('2001:db8:85a3::8a2e:370:7334'), 'd901045020010db885a3000000008a2e03707334'),
++    (ip_address(u'192.10.10.1'), 'd9010444c00a0a01'),
++    (ip_address(u'2001:db8:85a3::8a2e:370:7334'), 'd901045020010db885a3000000008a2e03707334'),
+ ], ids=[
+     'ipv4',
+     'ipv6',
+@@ -315,8 +315,8 @@ def test_ipaddress(impl, value, expected
+ 
+ @pytest.mark.skipif(sys.version_info < (3, 3), reason="Network encoding requires Py3.3+")
+ @pytest.mark.parametrize('value, expected', [
+-    (ip_network('192.168.0.100/24', False), 'd90105a144c0a800001818'),
+-    (ip_network('2001:db8:85a3:0:0:8a2e::/96', False),
++    (ip_network(u'192.168.0.100/24', False), 'd90105a144c0a800001818'),
++    (ip_network(u'2001:db8:85a3:0:0:8a2e::/96', False),
+      'd90105a15020010db885a3000000008a2e000000001860'),
+ ], ids=[
+     'ipv4',
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-cbor2.git/commitdiff/bf58754e46b7369df2dc70871c61c81082e87902



More information about the pld-cvs-commit mailing list