summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SPECS/python-onionbalance.spec94
1 files changed, 22 insertions, 72 deletions
diff --git a/SPECS/python-onionbalance.spec b/SPECS/python-onionbalance.spec
index fee15fe..c7067fe 100644
--- a/SPECS/python-onionbalance.spec
+++ b/SPECS/python-onionbalance.spec
@@ -4,17 +4,14 @@
# EL7 has a too old sphinx version
# to support generating of docs
-%if 0%{?fedora} || 0%{?rhel} >= 8
-%global with_python3 1
-%global with_docs 1
-%global main_pkg python3-%{pkgname}
-%else
-%global with_python3 0
-%global with_docs 0
-%global main_pkg python2-%{pkgname}
%if 0%{?rhel} == 7
%global for_el7 1
-%endif
+%global with_docs 0
+%global main_pkg python2-%{pkgname}
+%else
+%global with_docs 1
+%global for_el7 0
+%global main_pkg python3-%{pkgname}
%endif
# test libs are too old for running tests on EL7 & F24
@@ -45,27 +42,15 @@ BuildArch: noarch
BuildRequires: systemd-units
-BuildRequires: python2-devel
-BuildRequires: python-setuptools
%if 0%{?for_el7}
+BuildRequires: python-setuptools
+BuildRequires: python2-devel
BuildRequires: python-stem
-%else
-BuildRequires: python2-stem
-%endif
BuildRequires: PyYAML
BuildRequires: python2-crypto
BuildRequires: python2-future
BuildRequires: python-setproctitle
-%if 0%{?with_test}
-BuildRequires: python2-pexpect
-BuildRequires: python2-pytest
-BuildRequires: python2-pytest-mock
-%endif
-%if 0%{?with_docs}
-BuildRequires: python2-sphinxcontrib-autoprogram
-%endif
-
-%if 0%{?with_python3}
+%else
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-stem
@@ -74,12 +59,10 @@ BuildRequires: python3-crypto
BuildRequires: python3-future
BuildRequires: python3-setproctitle
BuildRequires: python3-sphinxcontrib-autoprogram
-%if 0%{?with_test}
BuildRequires: python3-pytest
BuildRequires: python3-pytest-mock
BuildRequires: python3-pexpect
%endif
-%endif
BuildRequires: systemd
@@ -89,7 +72,8 @@ OnionBalance provides load-balancing and redundancy for Tor
onion services by distributing requests to multiple back-end
Tor instances.
-%package -n python2-%{pkgname}
+%package -n %{main_pkg}
+%if 0%{?for_el7}
Summary: %{sum}
Requires: python-stem
Requires: PyYAML
@@ -102,9 +86,7 @@ Requires: python2-crypto
Requires: python2-future
Requires: python-setproctitle
%{?python_provide:%python_provide python2-%{pkgname}}
-%if 0%{?with_python3}
-
-%package -n python3-%{pkgname}
+%else
Summary: %{sum}
Requires: python3-stem
Requires: python3-PyYAML
@@ -121,29 +103,20 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
-
-%description -n python2-%{pkgname}
-OnionBalance provides load-balancing and redundancy for Tor
-onion services by distributing requests to multiple back-end
-Tor instances.
-%if 0%{?with_python3}
-
-%description -n python3-%{pkgname}
+%description -n %{main_pkg}
OnionBalance provides load-balancing and redundancy for Tor
onion services by distributing requests to multiple back-end
Tor instances.
This package contains systemd files as well as logrotate rules.
-%else
-This package contains systemd files as well as logrotate rules.
-%endif
%prep
%autosetup -n %{pkgname}-%{version}
%build
find . -name '*.pyc' -delete
+%if 0%{?for_el7}
%py2_build
-%if 0%{?with_python3}
+%else
%py3_build
%endif
%if 0%{?with_docs}
@@ -156,11 +129,9 @@ rm -rf docs/_build/html/.doctrees docs/_build/html/.buildinfo
%endif
%install
+%if 0%{?for_el7}
%py2_install
-%if 0%{?with_python3}
-cp %{buildroot}/%{_bindir}/%{pkgname} %{buildroot}/%{_bindir}/%{pkgname}-py2
-cp %{buildroot}/%{_bindir}/%{pkgname}-config %{buildroot}/%{_bindir}/%{pkgname}-config-py2
-
+%else
%py3_install
%endif
@@ -191,7 +162,6 @@ install -p -m 644 %{SOURCE6} .
%check
# on some versions test libs are too old to run
%if 0%{?with_test}
-py.test --ignore=test/functional
py.test-3 --ignore=test/functional
%endif
@@ -210,35 +180,20 @@ exit 0
%postun -n %{main_pkg}
%systemd_postun_with_restart onionbalance.service
-%files -n python2-%{pkgname}
+%files -n %{main_pkg}
%doc README.rst
%doc README.fedora
%doc onionbalance.torrc.example
%license COPYING
+%if 0%{?with_docs}
%doc docs/_build/html
%doc %attr(0644,root,root) %{_mandir}/man1/%{pkgname}*
+%endif
+%if 0%{?for_el7}
%{python2_sitelib}/*
-%if 0%{?with_python3}
-%{_bindir}/%{pkgname}-py2
-%{_bindir}/%{pkgname}-config-py2
%else
-%{_bindir}/%{pkgname}
-%{_bindir}/%{pkgname}-config
-%{_unitdir}/%{pkgname}.service
-%{_tmpfilesdir}/%{pkgname}.conf
-%dir %attr(0750,root,%{toruser}) %{_sysconfdir}/%{pkgname}
-%dir %attr(0750,%{pkgname},%{toruser}) %{_localstatedir}/log/%{pkgname}
-%dir %attr(0750,%{pkgname},%{toruser}) %{_localstatedir}/lib/%{pkgname}
-%config(noreplace) %{_sysconfdir}/logrotate.d/%{pkgname}.conf
-%endif
-
-%if 0%{?with_python3}
-%files -n python3-%{pkgname}
-%doc README.rst
-%doc README.fedora
-%doc onionbalance.torrc.example
-%license COPYING
%{python3_sitelib}/*
+%endif
%{_bindir}/%{pkgname}
%{_bindir}/%{pkgname}-config
%{_unitdir}/%{pkgname}.service
@@ -247,11 +202,6 @@ exit 0
%dir %attr(0750,%{pkgname},%{toruser}) %{_localstatedir}/log/%{pkgname}
%dir %attr(0750,%{pkgname},%{toruser}) %{_localstatedir}/lib/%{pkgname}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{pkgname}.conf
-%if 0%{?with_docs}
-%doc docs/_build/html
-%doc %attr(0644,root,root) %{_mandir}/man1/%{pkgname}*
-%endif
-%endif
%changelog
* Fri Jan 20 2017 Marcel Haerry <mh+fedora@scrit.ch> - 0.1.6-1