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

%global commit 3c25814664fef5b78716ed8841123ed1c0d17824
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name: python-websocket-client
Version: 0.56.0
Release: 3.git%{shortcommit}%{?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
Source0: https://github.com/%{distname}/%{distname}/archive/%{commit}/%{distname}-%{shortcommit}.tar.gz
Patch0: 0001-urlparse-import-conditionals-for-rhel7.patch
Patch1: 0001-provide-system-ca-bundle-as-default-if-no-bundle-is-.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-six
BuildRequires: git

%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
%autosetup -Sgit -n %{distname}-%{commit}

# Remove bundled egg-info in case it exists
rm -rf %{distname}.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
* Wed Jun 12 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.56.0-3.git3c25814
- Correct bug id in previous changelog

* Wed Jun 12 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.56.0-2.git3c25814
- Resolves: #1719354

* Mon May 13 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.56.0-1.git3c25814
- Resolves: #1702715

* Mon Aug 31 2015 Lokesh Mandvekar <lsm5@redhat.com> - 0.32.0-116
- Update to 0.32.0

* Tue Jun 16 2015 Lokesh Mandvekar <lsm5@redhat.com> - 0.14.1-98
- Rebuild fedora rawhide specfile for extras-rhel-7.1
- Release number abruptly bumped to obsolete subpackage generated from docker

* 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