From dfa956d860f25449c1c5e320d7b6e940139072b5 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Mar 27 2018 10:01:19 +0000 Subject: Conditionalize the Python 2 subpackage Don't build the Python 2 subpackage on EL > 7 --- diff --git a/python-websocket-client.spec b/python-websocket-client.spec index 727dabb..8ace776 100644 --- a/python-websocket-client.spec +++ b/python-websocket-client.spec @@ -1,5 +1,15 @@ %if 0%{?fedora} || 0%{?rhel} > 7 -%global with_python3 1 +# Enable python3 build by default +%bcond_without python3 +%else +%bcond_with python3 +%endif + +%if 0%{?rhel} > 7 +# Disable python2 build by default +%bcond_with python2 +%else +%bcond_without python2 %endif %global modname websocket @@ -8,7 +18,7 @@ Name: python-websocket-client Version: 0.47.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: WebSocket client for python License: LGPLv2 URL: https://github.com/websocket-client/websocket-client @@ -26,6 +36,7 @@ python-websocket-client supports only hybi-13. %description %_description +%if %{with python2} %package -n python2-websocket-client Summary: %{summary} BuildRequires: python2-devel @@ -43,9 +54,9 @@ Requires: python-six %description -n python2-websocket-client %_description +%endif # with python2 - -%if 0%{?with_python3} +%if %{with python3} %package -n python3-websocket-client Summary: %{summary} BuildRequires: python3-devel @@ -60,7 +71,7 @@ Conflicts: python2-websocket-client <= 0.40.0-4 %description -n python3-websocket-client %_description -%endif +%endif # with python3 %prep @@ -70,14 +81,17 @@ rm -r %{eggname}.egg-info %build +%if %{with python2} %py2_build +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} %py3_build -%endif +%endif # with python3 %install +%if %{with python2} # Must do the python2 install first because the scripts in /usr/bin are # overwritten with every setup.py install, and in general we want the # python3 version to be the default. @@ -89,8 +103,9 @@ ln -s /etc/pki/tls/cert.pem %{buildroot}%{python2_sitelib}/%{modname}/cacert.pem # remove tests that got installed into the buildroot rm -r %{buildroot}%{python2_sitelib}/%{modname}/tests +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} %py3_install # unbundle cacert and link in the mozilla ca @@ -99,7 +114,7 @@ ln -s /etc/pki/tls/cert.pem %{buildroot}%{python3_sitelib}/%{modname}/cacert.pem # remove tests that got installed into the buildroot rm -r %{buildroot}%{python3_sitelib}/%{modname}/tests -%endif +%endif # with python3 # https://fedoraproject.org/wiki/Packaging:Python#Executables_in_.2Fusr.2Fbin # wsdump has the same functionality on py2 and py3, so only ship one version @@ -107,13 +122,15 @@ mv %{buildroot}%{_bindir}/wsdump.py %{buildroot}%{_bindir}/wsdump %check -%if 0%{?with_python3} +%if %{with python3} %{__python3} setup.py test -%endif +%endif # with python3 +%if %{with python2} %{__python2} setup.py test +%endif # with python2 - +%if %{with python2} %files -n python2-websocket-client %license LICENSE %doc README.rst @@ -122,19 +139,24 @@ mv %{buildroot}%{_bindir}/wsdump.py %{buildroot}%{_bindir}/wsdump %if ! 0%{?with_python3} %{_bindir}/wsdump %endif +%endif # with python2 -%if 0%{?with_python3} +%if %{with python3} %files -n python3-websocket-client %license LICENSE %doc README.rst %{python3_sitelib}/%{modname}/ %{python3_sitelib}/%{eggname}*%{version}* %{_bindir}/wsdump -%endif +%endif # with python3 %changelog +* Tue Mar 27 2018 Charalampos Stratakis - 0.47.0-2 +- Conditionalize the Python 2 subpackage +- Don't build the Python 2 subpackage on EL > 7 + * Mon Mar 26 2018 Jan Beran - 0.47.0-1 - Latest upstream (rhbz# 1548228) - Fixes python3-websocket-client requires both Python 2 and 3 (rhbz# 1531541)