[packages/python-pyxmpp2] Rel 7; some python 3.9+ fixes; use newer TLS version; workaround newer setuptools lacking 2to3 fixer
arekm
arekm at pld-linux.org
Thu May 26 10:46:57 CEST 2022
commit 875c782818df6af84e5385a1027a6d125250b6b0
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu May 26 10:46:42 2022 +0200
Rel 7; some python 3.9+ fixes; use newer TLS version; workaround newer setuptools lacking 2to3 fixers by manually doing 2to3
newer-setuptools.patch | 11 +++++++++++
py.patch | 30 ++++++++++++++++++++++++++++++
python-pyxmpp2.spec | 44 +++++++++++++++++++++++++++++++++++++++-----
tls.patch | 11 +++++++++++
4 files changed, 91 insertions(+), 5 deletions(-)
---
diff --git a/python-pyxmpp2.spec b/python-pyxmpp2.spec
index a978cd2..0aa0860 100644
--- a/python-pyxmpp2.spec
+++ b/python-pyxmpp2.spec
@@ -10,12 +10,15 @@
Summary: XMPP implementation for Python
Name: python-%{pypi_name}
Version: 2.0.1
-Release: 6
+Release: 7
License: LGPL v2.1+
Group: Libraries/Python
#Source0: https://github.com/Jajcus/pyxmpp2/releases/download/2.0.1/pyxmpp2-2.0.1.tar.gz
Source0: https://github.com/Jajcus/pyxmpp2/archive/%{version}.tar.gz
# Source0-md5: add2c546f4473385c7222b623175e6ba
+Patch0: py.patch
+Patch1: tls.patch
+Patch2: newer-setuptools.patch
URL: https://github.com/Jajcus/pyxmpp2
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
@@ -27,12 +30,16 @@ BuildRequires: python-pyasn1
%endif
%endif
%if %{with python3}
+BuildRequires: python3-2to3
BuildRequires: python3-modules
BuildRequires: python3-setuptools
%if %{with tests}
BuildRequires: python3-pyasn1
%endif
%endif
+%if %{with doc}
+BuildRequires: epydoc
+%endif
Requires: python-dns >= 1.16.0
Requires: python-modules
BuildArch: noarch
@@ -63,25 +70,45 @@ Dokumentacja API modułu Pythona %{module}.
%prep
%setup -q -n %{pypi_name}-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+install -d orgsrc
+mv !(orgsrc) orgsrc
+%if %{with python2}
+cp -a orgsrc python2-src
+%endif
+
+%if %{with python3}
+cp -a orgsrc python3-src
+2to3-%{py3_ver} -w --no-diffs python3-src
+%endif
%build
%if %{with python2}
+cd python2-src
%py_build %{?with_tests:test}
+cd ..
%endif
%if %{with python3}
+cd python3-src
%py3_build %{?with_tests:test}
+cd ..
%endif
%if %{with doc}
-cd doc
+cd orgsrc/doc
%{__make}
+cd ..
%endif
%install
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
+cd python2-src
%py_install
# when files are installed in other way that standard 'setup.py
@@ -91,24 +118,31 @@ rm -rf $RPM_BUILD_ROOT
%py_comp $RPM_BUILD_ROOT%{py_sitedir}
%py_postclean
+cd ..
%endif
%if %{with python3}
+cd python3-src
%py3_install
+cd ..
%endif
# in case there are examples provided
%if %{with python2}
+cd python2-src
install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \
| xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
+cd ..
%endif
%if %{with python3}
+cd python3-src
install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \
| xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
+cd ..
%endif
%clean
@@ -117,7 +151,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc README.rst TODO
+%doc orgsrc/{README.rst,TODO}
%{py_sitescriptdir}/%{module}
%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%{_examplesdir}/python-%{pypi_name}-%{version}
@@ -126,7 +160,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python3}
%files -n python3-%{pypi_name}
%defattr(644,root,root,755)
-%doc README.rst TODO
+%doc orgsrc/{README.rst,TODO}
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%{_examplesdir}/python3-%{pypi_name}-%{version}
@@ -135,5 +169,5 @@ rm -rf $RPM_BUILD_ROOT
%if %{with doc}
%files apidocs
%defattr(644,root,root,755)
-%doc doc/www/api/*
+%doc orgsrc/doc/www/api/*
%endif
diff --git a/newer-setuptools.patch b/newer-setuptools.patch
new file mode 100644
index 0000000..bfff64b
--- /dev/null
+++ b/newer-setuptools.patch
@@ -0,0 +1,11 @@
+--- pyxmpp2-2.0.1/setup.py~ 2017-11-27 21:15:25.000000000 +0100
++++ pyxmpp2-2.0.1/setup.py 2022-05-26 10:42:49.039970764 +0200
+@@ -26,8 +26,6 @@ else:
+
+ extra = {}
+ if sys.version_info[0] >= 3:
+- extra['use_2to3'] = True
+- extra['use_2to3_fixers'] = ['custom_2to3']
+ install_requires = []
+ else:
+ install_requires = ['dnspython >=1.6.0']
diff --git a/py.patch b/py.patch
new file mode 100644
index 0000000..08f6381
--- /dev/null
+++ b/py.patch
@@ -0,0 +1,30 @@
+diff -urN pyxmpp2-2.0.1.org/pyxmpp2/roster.py pyxmpp2-2.0.1/pyxmpp2/roster.py
+--- pyxmpp2-2.0.1.org/pyxmpp2/roster.py 2017-11-27 21:15:25.000000000 +0100
++++ pyxmpp2-2.0.1/pyxmpp2/roster.py 2022-05-26 10:24:41.759970881 +0200
+@@ -40,7 +40,10 @@
+
+ import logging
+
+-from collections import Sequence, Mapping
++try:
++ from collections.abc import Sequence, Mapping
++except ImportError:
++ from collections import Sequence, Mapping
+
+ from .etree import ElementTree
+ from .settings import XMPPSettings
+diff -urN pyxmpp2-2.0.1.org/pyxmpp2/settings.py pyxmpp2-2.0.1/pyxmpp2/settings.py
+--- pyxmpp2-2.0.1.org/pyxmpp2/settings.py 2017-11-27 21:15:25.000000000 +0100
++++ pyxmpp2-2.0.1/pyxmpp2/settings.py 2022-05-26 10:25:09.986637542 +0200
+@@ -40,7 +40,10 @@
+ import argparse
+ import logging
+
+-from collections import MutableMapping
++try:
++ from collections.abc import MutableMapping
++except ImportError:
++ from collections import MutableMapping
+
+ logger = logging.getLogger("pyxmpp2.settings")
+
diff --git a/tls.patch b/tls.patch
new file mode 100644
index 0000000..91e4c1f
--- /dev/null
+++ b/tls.patch
@@ -0,0 +1,11 @@
+--- pyxmpp2-2.0.1/pyxmpp2/streamtls.py~ 2017-11-27 21:15:25.000000000 +0100
++++ pyxmpp2-2.0.1/pyxmpp2/streamtls.py 2022-05-26 10:25:42.639970868 +0200
+@@ -178,7 +178,7 @@ class StreamTLSHandler(StreamFeatureHand
+ certfile = self.settings["tls_cert_file"],
+ server_side = not self.stream.initiator,
+ cert_reqs = cert_reqs,
+- ssl_version = ssl.PROTOCOL_TLSv1,
++ ssl_version = ssl.PROTOCOL_TLS,
+ ca_certs = self.settings["tls_cacert_file"],
+ do_handshake_on_connect = False,
+ )
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-pyxmpp2.git/commitdiff/875c782818df6af84e5385a1027a6d125250b6b0
More information about the pld-cvs-commit
mailing list