maha / rpms / python-stem

Forked from rpms/python-stem 5 years ago
Clone
Blob Blame History Raw
%global pkgname stem
%global with_python3 1

Name:           python-stem
Version:        1.4.1b
Release:        5%{?dist}
Summary:        Python controller library for Tor

Group:          Development/Libraries
# All source code is LGPLv3 except stem/util/ordereddict.py which is MIT
License:        LGPLv3 and MIT
URL:            https://stem.torproject.org/
Source0:        https://pypi.python.org/packages/source/s/stem/%{pkgname}-%{version}.tar.bz2
# https://www.torproject.org/docs/signing-keys.html.en
Source1:        https://pypi.python.org/packages/source/s/stem/%{pkgname}-%{version}.tar.bz2.asc

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-sphinx
BuildRequires:  python-mock
BuildRequires:  python-crypto
BuildRequires:  python-pytest-flakes
BuildRequires:  python-pytest-pep8
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-crypto
BuildRequires:  python3-pytest-flakes
BuildRequires:  python3-pytest-pep8
%endif

%description
Stem is a python controller library for Tor.
It uses Tor’s control protocol to help developers program against the
Tor process.

%package -n python2-%{pkgname}
Summary:        Python controller library for Tor
Group:          Development/Libraries
%{?python_provide:%python_provide python2-%{pkgname}}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python2-%{pkgname}
Stem is a python controller library for Tor.
It uses Tor’s control protocol to help developers program against the
Tor process.

%if 0%{?with_python3}
%package -n python3-%{pkgname}
Summary:        Python controller library for Tor
Group:          Development/Libraries
%{?python_provide:%python_provide python3-%{pkgname}}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python3-%{pkgname}
Stem is a python controller library for Tor.
It uses Tor’s control protocol to help developers program against the
Tor process.
%endif

%package doc
Summary:        Python controller library for Tor - Documentation
Group:          Documentation

%description doc
Stem is a python controller library for Tor.
It uses Tor’s control protocol to help developers program against the
Tor process.

This package contains documentation files for Stem.

%prep
%autosetup -n %{pkgname}-1.4.1

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


%build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
%py3_build
popd
%endif

pushd docs
%make_build html
%make_build text
%make_build man
popd

%install
%if 0%{?with_python3}
pushd %{py3dir}
%py3_install
mv %{buildroot}%{_bindir}/tor-prompt %{buildroot}%{_bindir}/python3-tor-prompt
popd
%endif
%py2_install
mv %{buildroot}%{_bindir}/tor-prompt %{buildroot}%{_bindir}/python2-tor-prompt
pushd %{buildroot}%{_bindir}
%if 0%{?with_python3}
for i in tor-prompt tor-prompt-3 tor-prompt-%{?python3_version}; do
  ln -s python3-tor-prompt $i
done
%endif
for i in tor-prompt-2 tor-prompt-%{?python2_version}; do
  ln -s python2-tor-prompt $i
done
popd

mv -f docs/_build/html docs/
mv -f docs/_build/text docs/
find docs -name .buildinfo -delete
install -d %{buildroot}%{_mandir}/man1/
install -m 0644 docs/_build/man/%{pkgname}.1 %{buildroot}%{_mandir}/man1/

%check
%{__python2} run_tests.py --unit
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} run_tests.py --unit
popd
%endif

%files -n python2-%{pkgname}
%license LICENSE
%{_bindir}/python2-tor-prompt
%{_bindir}/tor-prompt-2
%{_bindir}/tor-prompt-%{?python2_version}
%{python2_sitelib}/%{pkgname}
%{python2_sitelib}/%{pkgname}-*.egg-info

%if 0%{?with_python3}
%files -n python3-%{pkgname}
%license LICENSE
%{_bindir}/python3-tor-prompt
%{_bindir}/tor-prompt
%{_bindir}/tor-prompt-3
%{_bindir}/tor-prompt-%{?python3_version}
%{python3_sitelib}/%{pkgname}
%{python3_sitelib}/%{pkgname}-*.egg-info
%endif

%files doc
%doc docs/html docs/text
%license LICENSE
%{_mandir}/man1/%{pkgname}.1*

%changelog
* Wed Nov 25 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.1b-5
- Rename file to python2-tor-prompt

* Tue Nov 24 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.1b-4
- Rebuild for Python 3.5 again

* Sun Nov 15 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.1b-3
- Use python_provide macro
- Create symbolic links to tor-prompt

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1b-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Jun 17 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.1b-1
- Version 1.4.1b

* Mon May 18 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.1-1
- Version 1.4.1

* Wed May 13 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.0-2
- Skip integration tests

* Wed May 13 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.4.0-1
- Version 1.4.0

* Thu Apr 09 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.3.0-3
- Use license macro

* Wed Dec 24 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.3.0-2
- Run tests

* Tue Dec 23 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.3.0-1
- Version 1.3.0
- Add documentation in text format

* Sat Jun 14 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.2.2-2
- Rename tor-prompt to python3-tor-prompt in python3 subpackage

* Thu Jun 12 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.2.2-1
- Version 1.2.2

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 09 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-2
- Rebuilt for F21 Python 3.4

* Sun Nov 10 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-1
- Version 1.1.1

* Tue Oct 15 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.0-1
- Version 1.1.0

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Apr 28 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-4
- Enable parallel make

* Sun Apr 28 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-3
- Add doc subpackage

* Sun Apr 07 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-2
- Update Source URL

* Wed Mar 27 2013 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.0.1-1
- Add python3 subpackage
- Update to 1.0.1

* Wed Mar 27 2013 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.0.0-1
- Version 1.0.0

* Tue Feb 26 2013 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 0-0.2.20130226gitbe9a532
- Update source code

* Sun Jan 13 2013 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 0-0.1.20130113git
- Initial packaging