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

%{!?_licensedir: %global license %%doc}

%if 0%{?rhel} && 0%{?rhel} <= 5
%{!?__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

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

Name:               python-pysocks
Version:            1.5.7
Release:            2%{?dist}
Summary:            %{sum}

License:            BSD
URL:                https://github.com/Anorov/PySocks
Source0:            https://github.com/Anorov/PySocks/archive/%{version}.tar.gz
BuildArch:          noarch

BuildRequires:      python2-devel

%if 0%{?with_python3}
BuildRequires:      python%{python3_pkgversion}-devel
%endif

%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}
%{?python_provide:%python_provide python2-%{flatname}}

# https://bugzilla.redhat.com/show_bug.cgi?id=1334407
Obsoletes:  python-SocksiPy
Obsoletes:  python2-SocksiPy
Provides:   python-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 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{flatname}
Summary:            %{sum}
%{?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 0%{?with_python3}
%py3_build
%endif

%install
%py2_install
%if 0%{?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}
# https://github.com/Anorov/PySocks/issues/42
#%%doc README.md
# https://github.com/Anorov/PySocks/issues/43
#%%license LICENSE
%{python2_sitelib}/socks.py*
%{python2_sitelib}/sockshandler.py*
%{python2_sitelib}/%{distname}-%{version}*

%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{flatname}
# https://github.com/Anorov/PySocks/issues/42
#%%doc README.md
# https://github.com/Anorov/PySocks/issues/43
#%%license LICENSE
%{python3_sitelib}/socks.py*
%{python3_sitelib}/sockshandler.py*
%{python3_sitelib}/__pycache__/*socks*
%{python3_sitelib}/%{distname}-%{version}-*
%endif


%changelog
* Mon Nov 28 2016 Tim Orling <ticotimo@gmail.com> - 1.5.7-2
- Ship python34-pysocks in EL6

* Sat Sep 17 2016 Kevin Fenzi <kevin@scrye.com> - 1.5.7-1
- Update to 1.5.7

* Fri Sep 16 2016 Orion Poplawski <orion@cora.nwra.com> - 1.5.6-6
- Ship python34-pysocks in EPEL7

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

* Fri Jul 15 2016 Ralph Bean <rbean@redhat.com> - 1.5.6-4
- Change our conflicts on python-SocksiPy to an obsoletes/provides.
  https://bugzilla.redhat.com/show_bug.cgi?id=1334407

* Mon May 09 2016 Ralph Bean <rbean@redhat.com> - 1.5.6-3
- Fix typo in explicit conflicts.

* Tue May 03 2016 Ralph Bean <rbean@redhat.com> - 1.5.6-2
- We don't actually need setuptools here.

* Mon May 02 2016 Ralph Bean <rbean@redhat.com> - 1.5.6-1
- Initial package for Fedora