Blob Blame History Raw
%bcond_without python3

%global distname PySocks
%global flatname pysocks
%global sum     A Python SOCKS client module

Name:               python-pysocks
Version:            1.6.8
Release:            5%{?dist}
Summary:            %{sum}

License:            BSD
URL:                https://github.com/Anorov/PySocks
Source0:            https://files.pythonhosted.org/packages/source/P/PySocks/PySocks-%{version}.tar.gz
BuildArch:          noarch


%description
A fork of SocksiPy with bug fixes and extra features.

Acts as a drop-in replacement to the socket module. Featuring:

- SOCKS proxy client for Python 2.6 - 3.x
- TCP and UDP both supported
- HTTP proxy client included but not supported or recommended (you should use
  urllib2's or requests' own HTTP proxy interface)
- urllib2 handler included.


%package -n python2-%{flatname}
Summary:            %{sum}
BuildRequires:      python2-devel
BuildRequires:      python2-setuptools
%{?python_provide:%python_provide python2-%{flatname}}

# https://bugzilla.redhat.com/show_bug.cgi?id=1334407
Obsoletes:  python-SocksiPy
Obsoletes:  python2-SocksiPy
Provides:   python2-SocksiPy


%description -n python2-%{flatname}
A fork of SocksiPy with bug fixes and extra features.

Acts as a drop-in replacement to the socket module. Featuring:

- SOCKS proxy client for Python 2.6 - 3.x
- TCP and UDP both supported
- HTTP proxy client included but not supported or recommended (you should use
  urllib2's or requests' own HTTP proxy interface)
- urllib2 handler included.


%if %{with python3}
%package -n python%{python3_pkgversion}-%{flatname}
Summary:            %{sum}
BuildRequires:      python%{python3_pkgversion}-devel
BuildRequires:      python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{flatname}}

# This package doesn't actually exist... but if it did, we would conflict with
# it.
Conflicts:  python%{python3_pkgversion}-SocksiPy


%description -n python%{python3_pkgversion}-%{flatname}
A fork of SocksiPy with bug fixes and extra features.

Acts as a drop-in replacement to the socket module. Featuring:

- SOCKS proxy client for Python 2.6 - 3.x
- TCP and UDP both supported
- HTTP proxy client included but not supported or recommended (you should use
  urllib2's or requests' own HTTP proxy interface)
- urllib2 handler included.

%endif

%prep
%autosetup -n %{distname}-%{version}

%build
%py2_build
%if %{with python3}
%py3_build
%endif


%install
%py2_install
%if %{with python3}
%py3_install
%endif


#%%check
## No tests included in the tarball...
## https://github.com/Anorov/PySocks/issues/37
#%%{__python2} setup.py test
#%%if 0%%{?with_python3}
#%%{__python3} setup.py test
#%%endif


%files -n python2-%{flatname}
%doc README.md
%license LICENSE
%{python2_sitelib}/socks.py*
%{python2_sitelib}/sockshandler.py*
%{python2_sitelib}/%{distname}-%{version}*

%if %{with python3}
%files -n python%{python3_pkgversion}-%{flatname}
%doc README.md
%license LICENSE
%{python3_sitelib}/socks.py*
%{python3_sitelib}/sockshandler.py*
%{python3_sitelib}/__pycache__/*socks*
%{python3_sitelib}/%{distname}-%{version}-*
%endif


%changelog
* Mon Sep 17 2018 Tomas Orsava <torsava@redhat.com> - 1.6.8-5
- Stop providing the unversioned name python-SocksiPy
- Resolves: rhbz#1628242

* Tue Jul 31 2018 Lumír Balhar <lbalhar@redhat.com> - 1.6.8-4
- Make possible to disable python3 subpackage

* Mon Jul 16 2018 Lumír Balhar <lbalhar@redhat.com> - 1.6.8-3
- First version for python27 module