Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif

%global modname websocket
%global distname websocket-client
%global eggname websocket_client

Name:               python-websocket-client
Version:            0.47.0
Release:            1%{?dist}
Summary:            WebSocket client for python
License:            LGPLv2
URL:                https://github.com/websocket-client/websocket-client
Source0:            https://files.pythonhosted.org/packages/source/w/%{distname}/%{eggname}-%{version}.tar.gz
BuildArch:          noarch

%global _description\
python-websocket-client module is WebSocket client for python. This\
provides the low level APIs for WebSocket. All APIs are the synchronous\
functions.\
\
python-websocket-client supports only hybi-13.


%description %_description


%package -n python2-websocket-client
Summary:            %{summary}
BuildRequires:      python2-devel
BuildRequires:      python-setuptools
BuildRequires:      python-backports-ssl_match_hostname
BuildRequires:      python-six
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires:      python-unittest2
BuildRequires:      python-argparse
Requires:           python-argparse
%endif
Requires:           python-backports-ssl_match_hostname
Requires:           python-six
%{?python_provide:%python_provide python2-websocket-client}


%description -n python2-websocket-client %_description


%if 0%{?with_python3}
%package -n python3-websocket-client
Summary:            %{summary}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
BuildRequires:      python3-six
Requires:           python3-six
%{?python_provide:%python_provide python3-websocket-client}

# https://fedoraproject.org/wiki/Packaging:Conflicts#Splitting_Packages
# wsdump moved from py2 to py3 package
Conflicts:          python2-websocket-client <= 0.40.0-4


%description -n python3-websocket-client %_description
%endif


%prep
%setup -q -n %{eggname}-%{version}

rm -r %{eggname}.egg-info


%build
%py2_build

%if 0%{?with_python3}
%py3_build
%endif


%install
# 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.
%py2_install

# unbundle cacert and link in the mozilla ca
rm %{buildroot}%{python2_sitelib}/%{modname}/cacert.pem
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

%if 0%{?with_python3}
%py3_install

# unbundle cacert and link in the mozilla ca
rm %{buildroot}%{python3_sitelib}/%{modname}/cacert.pem
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

# https://fedoraproject.org/wiki/Packaging:Python#Executables_in_.2Fusr.2Fbin
# wsdump has the same functionality on py2 and py3, so only ship one version
mv %{buildroot}%{_bindir}/wsdump.py %{buildroot}%{_bindir}/wsdump


%check
%if 0%{?with_python3}
%{__python3} setup.py test
%endif

%{__python2} setup.py test


%files -n python2-websocket-client
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{eggname}*%{version}*
%if ! 0%{?with_python3}
%{_bindir}/wsdump
%endif


%if 0%{?with_python3}
%files -n python3-websocket-client
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{eggname}*%{version}*
%{_bindir}/wsdump
%endif


%changelog
* Mon Mar 26 2018 Jan Beran <jberan@redhat.com> - 0.47.0-1
- Latest upstream (rhbz# 1548228)
- Fixes python3-websocket-client requires both Python 2 and 3 (rhbz# 1531541)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.46.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Jan 02 2018 Carl George <carl@george.computer> - 0.46.0-1
- Latest upstream rhbz#1462523
- Only ship one version of wsdump
- Properly install LICENSE file
- Remove tests from buildroot
- Use Python build, install, and provides macros

* Sun Dec 17 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.40.0-4
- Python 2 binary package renamed to python2-websocket-client
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 0.40.0-3
- Cleanup spec file conditionals

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.40.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Feb 27 2017 Ralph Bean <rbean@redhat.com> - 0.40.0-1
- new version

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.37.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.37.0-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.37.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Apr 14 2016 Ralph Bean <rbean@redhat.com> - 0.37.0-1
- new version

* Mon Apr 04 2016 Ralph Bean <rbean@redhat.com> - 0.35.0-1
- new version

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.34.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.34.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Oct 28 2015 Ralph Bean <rbean@redhat.com> - 0.34.0-1
- new version

* Tue Oct 27 2015 Ralph Bean <rbean@redhat.com> - 0.33.0-1
- new version

* Mon Jul 27 2015 Ralph Bean <rbean@redhat.com> - 0.32.0-1
- new version

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.14.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Thu May 22 2014 Ralph Bean <rbean@redhat.com> - 0.14.1-1
- Latest upstream with python3 support.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Apr 10 2013 Ralph Bean <rbean@redhat.com> - 0.10.0-1
- Latest upstream release.
- Removed executable bit from installed lib files for rpmlint.

* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 0.9.0-2
- Replaced websocket_client with %%{eggname} as per review by Palle Ravn
  https://bugzilla.redhat.com/show_bug.cgi?id=909644#c4
- Removed a few unnecessary newlines.

* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 0.9.0-1
- Latest upstream.

* Sat Feb 09 2013 Ralph Bean <rbean@redhat.com> - 0.8.0-1
- Initial package for Fedora