# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files(the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions : # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. ############################################################################### %global with_python2 1 %global with_python3 1 %if 0%{?fedora} || 0%{?rhel} >= 8 # Python v2 Support dropped %global with_python2 0 %endif %if 0%{?_module_build} %bcond_with tests %else # When bootstrapping Python, we cannot test this yet %bcond_without tests %endif %if 0%{?rhel} && 0%{?rhel} <= 7 %global with_python3 0 %endif %global pypi_name sleekxmpp %global common_description %{expand: \ SleekXMPP is a XMPP Client} Name: python-%{pypi_name} Version: 1.3.3 Release: 1%{?dist} Summary: An XMPP Client License: MIT URL: https://github.com/fritzy/SleekXMPP Source0: %{pypi_source} # sleekxmpp has a function called async() which clashes with the keyword # used in Python v3.x; this renames it to _async() to avoid the collision Patch0: async_collision_fix.patch # The unit tests try to test this plugin but it is not shipped (anymore?) # with sleekxmpp. This patch simply removes to tests that surround this # plugin Patch1: no_xep_0079_plugin.patch # Drop only test that does not pass in RHEL 7 environments Patch2: rhel7-compatible-test-failure.patch BuildArch: noarch %description %{common_description} %if 0%{?with_python2} %package -n python2-%{pypi_name} Summary: An XMPP Client %{?python_provide:%python_provide python2-%{pypi_name}} BuildRequires: python2-devel %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python-dns BuildRequires: python-pyasn1 BuildRequires: python-pyasn1-modules %else BuildRequires: python2-dns BuildRequires: python2-pyasn1 BuildRequires: python2-pyasn1-modules %endif %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: python-dns Requires: python-pyasn1 Requires: python-pyasn1-modules %else Requires: python2-dns Requires: python2-pyasn1 Requires: python2-pyasn1-modules %endif %if %{with tests} BuildRequires: python-mock BuildRequires: python2-pytest-runner BuildRequires: python2-pytest BuildRequires: gnupg %endif %description -n python2-%{pypi_name} %{common_description} %endif %if 0%{?with_python3} %package -n python%{python3_pkgversion}-%{pypi_name} Summary: An XMPP Client %{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-dns BuildRequires: python%{python3_pkgversion}-pyasn1 BuildRequires: python%{python3_pkgversion}-pyasn1-modules Requires: python%{python3_pkgversion}-dns Requires: python%{python3_pkgversion}-pyasn1 Requires: python%{python3_pkgversion}-pyasn1-modules %if %{with tests} BuildRequires: python%{python3_pkgversion}-mock BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-pytest-runner BuildRequires: gnupg %endif %description -n python%{python3_pkgversion}-%{pypi_name} %{common_description} %endif %prep %setup -q -n %{pypi_name}-%{version} %patch0 -p1 %patch1 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 %patch2 -p1 %endif # Eliminate test that hits a website on the internet rm tests/live_test.py %build %if 0%{?with_python2} %py2_build %endif %if 0%{?with_python3} %py3_build %endif %install %if 0%{?with_python2} %py2_install %endif %if 0%{?with_python3} %py3_install %endif %if %{with tests} %check %if 0%{?with_python2} LANG=C.UTF-8 PYTHONPATH=%{buildroot}%{python2_sitelib} py.test %endif %if 0%{?with_python3} LANG=C.UTF-8 PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} %endif %endif %if 0%{?with_python2} %files -n python2-%{pypi_name} %license LICENSE %doc README.rst %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/*.egg-info %endif %if 0%{?with_python3} %files -n python%{python3_pkgversion}-%{pypi_name} %license LICENSE %doc README.rst %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/*.egg-info %endif %changelog * Fri Mar 27 2020 Chris Caron - 1.3.3-1 - Initial version ov 1.3.3