6a0f0d
%if 0%{?rhel} && 0%{?rhel} <= 6
6a0f0d
%{!?__python2: %global __python2 /usr/bin/python2}
6a0f0d
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
6a0f0d
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
6a0f0d
%endif
6a0f0d
6a0f0d
%if 0%{?fedora}
6a0f0d
%global with_python3 1
6a0f0d
%endif
6a0f0d
6a0f0d
%global modname websocket
6a0f0d
%global distname websocket-client
6a0f0d
%global eggname websocket_client
6a0f0d
68fe03
%global commit 3c25814664fef5b78716ed8841123ed1c0d17824
68fe03
%global shortcommit %(c=%{commit}; echo ${c:0:7})
68fe03
6a0f0d
Name: python-websocket-client
68fe03
Version: 0.56.0
68fe03
Release: 1.git%{shortcommit}%{?dist}
6a0f0d
Summary: WebSocket client for python
6a0f0d
Group: Development/Libraries
6a0f0d
License: LGPLv2
6a0f0d
URL: http://pypi.python.org/pypi/websocket-client
68fe03
#Source0: http://pypi.python.org/packages/source/w/%%{distname}/%%{eggname}-%%{version}.tar.gz
68fe03
Source0: https://github.com/%{distname}/%{distname}/archive/%{commit}/%{distname}-%{shortcommit}.tar.gz
68fe03
Patch0: 0001-urlparse-import-conditionals-for-rhel7.patch
6a0f0d
BuildArch: noarch
6a0f0d
BuildRequires: python2-devel
6a0f0d
BuildRequires: python-setuptools
6a0f0d
BuildRequires: python-six
68fe03
BuildRequires: git
6a0f0d
6a0f0d
%if 0%{?with_python3}
6a0f0d
BuildRequires: python3-devel
6a0f0d
BuildRequires: python3-setuptools
6a0f0d
BuildRequires: python3-six
6a0f0d
%endif
6a0f0d
6a0f0d
%if 0%{?rhel} && 0%{?rhel} <= 6
6a0f0d
BuildRequires: python-unittest2
6a0f0d
BuildRequires: python-argparse
6a0f0d
Requires: python-argparse
6a0f0d
BuildRequires: python-backports-ssl_match_hostname
6a0f0d
Requires: python-backports-ssl_match_hostname
6a0f0d
%endif
6a0f0d
6a0f0d
Requires: python-six
6a0f0d
6a0f0d
%description
6a0f0d
python-websocket-client module is WebSocket client for python. This
6a0f0d
provides the low level APIs for WebSocket. All APIs are the synchronous
6a0f0d
functions.
6a0f0d
6a0f0d
python-websocket-client supports only hybi-13.
6a0f0d
6a0f0d
%if 0%{?with_python3}
6a0f0d
%package -n python3-websocket-client
6a0f0d
Summary: WebSocket client for python
6a0f0d
Group: Development/Libraries
6a0f0d
Requires: python3-six
6a0f0d
6a0f0d
%description -n python3-websocket-client
6a0f0d
python-websocket-client module is WebSocket client for python. This
6a0f0d
provides the low level APIs for WebSocket. All APIs are the synchronous
6a0f0d
functions.
6a0f0d
6a0f0d
python-websocket-client supports only hybi-13.
6a0f0d
%endif
6a0f0d
6a0f0d
%prep
68fe03
%autosetup -Sgit -n %{distname}-%{commit}
6a0f0d
6a0f0d
# Remove bundled egg-info in case it exists
6a0f0d
rm -rf %{distname}.egg-info
6a0f0d
6a0f0d
%if 0%{?with_python3}
6a0f0d
rm -rf %{py3dir}
6a0f0d
cp -a . %{py3dir}
6a0f0d
%endif
6a0f0d
6a0f0d
%build
6a0f0d
%if 0%{?with_python3}
6a0f0d
pushd %{py3dir}
6a0f0d
%{__python3} setup.py build
6a0f0d
popd
6a0f0d
%endif
6a0f0d
6a0f0d
%{__python2} setup.py build
6a0f0d
6a0f0d
%install
6a0f0d
%if 0%{?with_python3}
6a0f0d
pushd %{py3dir}
6a0f0d
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
6a0f0d
mv %{buildroot}/%{_bindir}/wsdump.py \
6a0f0d
    %{buildroot}/%{_bindir}/python3-wsdump
6a0f0d
6a0f0d
# unbundle cacert
6a0f0d
rm %{buildroot}/%{python3_sitelib}/%{modname}/cacert.pem
6a0f0d
# And link in the mozilla ca
6a0f0d
ln -s /etc/pki/tls/cert.pem \
6a0f0d
    %{buildroot}/%{python3_sitelib}/%{modname}/cacert.pem
6a0f0d
6a0f0d
# remove tests that got installed into the buildroot
6a0f0d
rm -rf %{buildroot}/%{python3_sitelib}/tests/
6a0f0d
6a0f0d
# Remove executable bit from installed files.
6a0f0d
find %{buildroot}/%{python3_sitelib} -type f -exec chmod -x {} \;
6a0f0d
popd
6a0f0d
%endif
6a0f0d
6a0f0d
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
6a0f0d
mv %{buildroot}/%{_bindir}/wsdump.py \
6a0f0d
    %{buildroot}/%{_bindir}/wsdump
6a0f0d
6a0f0d
# unbundle cacert
68fe03
#rm %%{buildroot}/%%{python2_sitelib}/%%{modname}/cacert.pem
6a0f0d
# And link in the mozilla ca
6a0f0d
ln -s /etc/pki/tls/cert.pem \
6a0f0d
    %{buildroot}/%{python2_sitelib}/%{modname}/cacert.pem
6a0f0d
6a0f0d
# remove tests that got installed into the buildroot
6a0f0d
rm -rf %{buildroot}/%{python2_sitelib}/tests/
6a0f0d
6a0f0d
# Remove executable bit from installed files.
6a0f0d
find %{buildroot}/%{python2_sitelib} -type f -exec chmod -x {} \;
6a0f0d
6a0f0d
%check
6a0f0d
%if 0%{?with_python3}
6a0f0d
pushd %{py3dir}
6a0f0d
%{__python3} setup.py test
6a0f0d
popd
6a0f0d
%endif
6a0f0d
6a0f0d
#%%{__python2} setup.py test
6a0f0d
6a0f0d
%files
6a0f0d
%doc README.rst LICENSE
6a0f0d
%{python2_sitelib}/%{modname}/
6a0f0d
%{python2_sitelib}/%{eggname}*%{version}*
6a0f0d
%{_bindir}/wsdump
6a0f0d
6a0f0d
%if 0%{?with_python3}
6a0f0d
%files -n python3-websocket-client
6a0f0d
%doc README.rst LICENSE
6a0f0d
%{python3_sitelib}/%{modname}/
6a0f0d
%{python3_sitelib}/%{eggname}*%{version}*
6a0f0d
%{_bindir}/python3-wsdump
6a0f0d
%endif
6a0f0d
6a0f0d
%changelog
68fe03
* Mon May 13 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.56.0-1.git3c25814
68fe03
- Resolves: #1702715
68fe03
6a0f0d
* Mon Aug 31 2015 Lokesh Mandvekar <lsm5@redhat.com> - 0.32.0-116
6a0f0d
- Update to 0.32.0
6a0f0d
6a0f0d
* Tue Jun 16 2015 Lokesh Mandvekar <lsm5@redhat.com> - 0.14.1-98
6a0f0d
- Rebuild fedora rawhide specfile for extras-rhel-7.1
6a0f0d
- Release number abruptly bumped to obsolete subpackage generated from docker
6a0f0d
6a0f0d
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-3
6a0f0d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
6a0f0d
6a0f0d
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.14.1-2
6a0f0d
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
6a0f0d
6a0f0d
* Thu May 22 2014 Ralph Bean <rbean@redhat.com> - 0.14.1-1
6a0f0d
- Latest upstream with python3 support.
6a0f0d
6a0f0d
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.0-2
6a0f0d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
6a0f0d
6a0f0d
* Wed Apr 10 2013 Ralph Bean <rbean@redhat.com> - 0.10.0-1
6a0f0d
- Latest upstream release.
6a0f0d
- Removed executable bit from installed lib files for rpmlint.
6a0f0d
6a0f0d
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 0.9.0-2
6a0f0d
- Replaced websocket_client with %%{eggname} as per review by Palle Ravn
6a0f0d
  https://bugzilla.redhat.com/show_bug.cgi?id=909644#c4
6a0f0d
- Removed a few unnecessary newlines.
6a0f0d
6a0f0d
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 0.9.0-1
6a0f0d
- Latest upstream.
6a0f0d
6a0f0d
* Sat Feb 09 2013 Ralph Bean <rbean@redhat.com> - 0.8.0-1
6a0f0d
- Initial package for Fedora