# package is Python 3.4+ compatible only %global __python %{__python3} # set upstream name variable %global srcname slixmpp # sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: python3-slixmpp Version: 1.3.0 Release: 1%{?dist} Summary: Slixmpp is an XMPP library for Python 3.4+ License: MIT URL: https://github.com/poezio/%{srcname} Source0: https://github.com/poezio/%{srcname}/archive/slix-%{version}/%{name}-%{version}.tar.gz Patch0: patch-remove-aiodns-dependancy.patch %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-Cython %endif # with python3 BuildRequires: libidn-devel # for docs BuildRequires: python2-sphinx # for tests BuildRequires: gnupg Requires: python3-pyasn1-modules %description Slixmpp is an MIT licensed XMPP library for Python 3.4+. It is a fork of SleekXMPP. Goals is to only rewrite the core of the library (the low level socket handling, the timers, the events dispatching) in order to remove all threads. %prep %setup -qc mv %{srcname}-slix-%{version} python2 # Apply patches pushd python2 %patch0 -p0 popd %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 # nothing to do popd %if %{with python3} pushd python3 CFLAGS="%{optflags}" %{__python3} setup.py build # Build sphinx documentation pushd docs/ make html popd # docs popd %endif # with python3 %install rm -rf %{buildroot} # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if %{with python3} pushd python3 %{__python3} setup.py install -O1 --skip-build --root %{buildroot} popd %endif # with python3 pushd python2 # nothing to do popd # Install html docs mkdir -p %{buildroot}%{_pkgdocdir}/ cp -pr python3/docs/_build/html %{buildroot}%{_pkgdocdir}/ # Remove sources rm -rf %{buildroot}%{_pkgdocdir}/html/_sources/ # Remove buildinfo sphinx documentation rm -rf %{buildroot}%{_pkgdocdir}/html/.buildinfo # Fix non-standard modes (775) chmod 755 %{buildroot}%{python3_sitearch}/%{srcname}/stringprep.cpython-*.so %check pushd python2 #nothing to do popd %if %{with python3} pushd python3 %{__python3} run_tests.py popd %endif %files %license python3/LICENSE %doc python3/CONTRIBUTING.rst python3/README.rst %{_pkgdocdir}/html/ # For arch-specific packages: sitearch %{python3_sitearch}/%{srcname}-%{version}-py3.6.egg-info/ %{python3_sitearch}/%{srcname}/ %changelog * Sun Apr 1 2018 Matthieu Saulnier - 1.3.0-1 - Initial package