2 %bcond_without doc # Sphinx documentation
3 %bcond_with tests # unit tests
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
8 %define egg_name pyxmpp2
9 %define pypi_name pyxmpp2
10 Summary: XMPP implementation for Python
11 Name: python-%{pypi_name}
15 Group: Libraries/Python
16 #Source0: https://github.com/Jajcus/pyxmpp2/releases/download/2.0.1/pyxmpp2-2.0.1.tar.gz
17 Source0: https://github.com/Jajcus/pyxmpp2/archive/%{version}.tar.gz
18 # Source0-md5: add2c546f4473385c7222b623175e6ba
21 Patch2: newer-setuptools.patch
22 URL: https://github.com/Jajcus/pyxmpp2
23 BuildRequires: rpm-pythonprov
24 BuildRequires: rpmbuild(macros) >= 1.714
26 BuildRequires: python-modules
27 BuildRequires: python-setuptools
29 BuildRequires: python-pyasn1
33 BuildRequires: python3-2to3
34 BuildRequires: python3-modules
35 BuildRequires: python3-setuptools
37 BuildRequires: python3-pyasn1
43 Requires: python-dns >= 1.16.0
44 Requires: python-modules
46 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49 XMPP implementation for Python.
51 %package -n python3-%{pypi_name}
52 Summary: XMPP implementation for Python
53 Group: Libraries/Python
54 Requires: python3-dns >= 1.16.0
55 Requires: python3-modules
57 %description -n python3-%{pypi_name}
58 XMPP implementation for Python.
61 Summary: API documentation for Python %{module} module
62 Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
66 API documentation for Python %{module} module.
68 %description apidocs -l pl.UTF-8
69 Dokumentacja API modułu Pythona %{module}.
72 %setup -q -n %{pypi_name}-%{version}
80 cp -a orgsrc python2-src
84 cp -a orgsrc python3-src
85 2to3-%{py3_ver} -w --no-diffs python3-src
86 sed -i -e 's#def __unicode__(#def __str__(#g' \
87 python3-src/pyxmpp2/*.py \
88 python3-src/auxtools/make_conformance_table.py \
89 python3-src/pyxmpp2/ext/vcard.py \
90 python3-src/pyxmpp2/test/resolver.py \
91 python3-src/pyxmpp2/mainloop/interfaces.py
97 %py_build %{?with_tests:test}
103 %py3_build %{?with_tests:test}
114 rm -rf $RPM_BUILD_ROOT
120 # when files are installed in other way that standard 'setup.py
121 # they need to be (re-)compiled
122 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
123 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
124 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
136 # in case there are examples provided
139 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
140 cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
141 find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \
142 | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
147 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
148 cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
149 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \
150 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
155 rm -rf $RPM_BUILD_ROOT
159 %defattr(644,root,root,755)
160 %doc orgsrc/{README.rst,TODO}
161 %{py_sitescriptdir}/%{module}
162 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
163 %{_examplesdir}/python-%{pypi_name}-%{version}
167 %files -n python3-%{pypi_name}
168 %defattr(644,root,root,755)
169 %doc orgsrc/{README.rst,TODO}
170 %{py3_sitescriptdir}/%{module}
171 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
172 %{_examplesdir}/python3-%{pypi_name}-%{version}
177 %defattr(644,root,root,755)
178 %doc orgsrc/doc/www/api/*