Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%if 0%{?fedora}
%global with_python3 1
%endif

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

Name:               python-websocket-client
Version:            0.37.0
Release:            1%{?dist}
Summary:            WebSocket client for python

Group:              Development/Libraries
License:            LGPLv2
URL:                http://pypi.python.org/pypi/websocket-client
Source0:            http://pypi.python.org/packages/source/w/%{distname}/%{eggname}-%{version}.tar.gz

BuildArch:          noarch

BuildRequires:      python2-devel
BuildRequires:      python-setuptools
BuildRequires:      python-six

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
BuildRequires:      python3-six
%endif

%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires:      python-unittest2
BuildRequires:      python-argparse
Requires:           python-argparse
BuildRequires:      python-backports-ssl_match_hostname
Requires:           python-backports-ssl_match_hostname
%endif

Requires:           python-six

%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.

%if 0%{?with_python3}
%package -n python3-websocket-client
Summary:            WebSocket client for python
Group:              Development/Libraries
Requires:           python3-six

%description -n python3-websocket-client
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.
%endif

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

# Remove bundled egg-info in case it exists
rm -rf %{distname}.egg-info
rm -rf %{eggname}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%{__python2} setup.py build



%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}/%{_bindir}/wsdump.py \
    %{buildroot}/%{_bindir}/python3-wsdump

# unbundle cacert
rm %{buildroot}/%{python3_sitelib}/%{modname}/cacert.pem
# And link in the mozilla ca
ln -s /etc/pki/tls/cert.pem \
    %{buildroot}/%{python3_sitelib}/%{modname}/cacert.pem

# remove tests that got installed into the buildroot
rm -rf %{buildroot}/%{python3_sitelib}/tests/

# Remove executable bit from installed files.
find %{buildroot}/%{python3_sitelib} -type f -exec chmod -x {} \;
popd
%endif

%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}/%{_bindir}/wsdump.py \
    %{buildroot}/%{_bindir}/wsdump

# unbundle cacert
rm %{buildroot}/%{python2_sitelib}/%{modname}/cacert.pem
# And link in the mozilla ca
ln -s /etc/pki/tls/cert.pem \
    %{buildroot}/%{python2_sitelib}/%{modname}/cacert.pem

# remove tests that got installed into the buildroot
rm -rf %{buildroot}/%{python2_sitelib}/tests/

# Remove executable bit from installed files.
find %{buildroot}/%{python2_sitelib} -type f -exec chmod -x {} \;

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

%{__python2} setup.py test

%files
%doc README.rst LICENSE
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{eggname}*%{version}*
%{_bindir}/wsdump

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

%changelog
* 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