Modernize, move executable to Python 3 (#1366193)

epel9
Miro Hrončok 9 years ago
parent 1c269861a6
commit 1fd92e9476

@ -1,8 +1,3 @@
%if 0%{?fedora} > 12
# virtualenv for python3 is missing
%global with_python3 1
%endif
# Tests requiring Internet connections are disabled by default
# pass --with internet to run them (e.g. when doing a local rebuild
# for sanity checks before committing)
@ -10,31 +5,45 @@
%global pypiname tox
Name: python-tox
Name: python-%{pypiname}
Version: 2.3.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Virtualenv-based automation of test activities
# file toxbootstrap.py is licensed under MIT License
License: GPLv2+ and MIT
URL: http://codespeak.net/tox
Source0: http://pypi.python.org/packages/source/t/%{pypiname}/%{pypiname}-%{version}.tar.gz
URL: http://tox.testrun.org/
Source0: https://files.pythonhosted.org/packages/source/t/%{pypiname}/%{pypiname}-%{version}.tar.gz
BuildArch: noarch
%description
Tox as is a generic virtualenv management and test command line tool you
can use for:
BuildArch: noarch
- checking your package installs correctly with different Python versions
and interpreters
- running your tests in each of the environments, configuring your test tool
of choice
- acting as a frontend to Continuous Integration servers, greatly reducing
boilerplate and merging CI and shell-based testing.
%package -n python2-%{pypiname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypiname}}
BuildRequires: python2-devel
BuildRequires: python-setuptools
Requires: python-py
Requires: python-virtualenv >= 1.11.2
BuildRequires: python2-setuptools
Requires: python2-py
Requires: python2-virtualenv >= 1.11.2
Requires: python-pluggy
# required for check
%if 0%{?fedora}
BuildRequires: python-py
BuildRequires: pytest
BuildRequires: python-virtualenv >= 1.11.2
%if %{with internet}
# for tests
BuildRequires: python2-py
BuildRequires: python2-pytest
BuildRequires: python2-virtualenv >= 1.11.2
%endif
%description
%description -n python2-%{pypiname}
Tox as is a generic virtualenv management and test command line tool you
can use for:
@ -45,16 +54,25 @@ can use for:
- acting as a frontend to Continuous Integration servers, greatly reducing
boilerplate and merging CI and shell-based testing.
%if 0%{?with_python3}
This package contains just the module you can import from Python 2,
for the actual command line utility, dnf install tox.
%package -n python3-%{pypiname}
Summary: Virtualenv-based automation of test activities
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypiname}}
Provides: %{pypiname} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: python3-py
Requires: python3-pluggy
# python3-virtualenv is rhbz#537246
Requires: python3-virtualenv
%if %{with internet}
# for tests
BuildRequires: python3-py
BuildRequires: python3-pytest
BuildRequires: python3-virtualenv
%endif
%description -n python3-%{pypiname}
Tox as is a generic virtualenv management and test command line tool you
@ -66,7 +84,6 @@ can use for:
of choice
- acting as a frontend to Continuous Integration servers, greatly reducing
boilerplate and merging CI and shell-based testing.
%endif
%prep
%setup -q -n %{pypiname}-%{version}
@ -74,68 +91,45 @@ can use for:
# remove bundled egg-info
rm -rf %{pypiname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%py2_build
%py3_build
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/tox %{buildroot}%{_bindir}/python3-tox
mv %{buildroot}%{_bindir}/tox-quickstart %{buildroot}%{_bindir}/python3-tox-quickstart
popd
%endif # with_python3
%py2_install
rm %{buildroot}%{_bindir}/%{pypiname}*
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
%py3_install
# if internet connection available, run tests
%if %{with internet}
%check
# python 2.7: fedora 17, fedora 18
# python 3.2: fedora 17
# python 3.3: fedora 18
# el6: buildrequirements missing
#%if 0%{?rhel}==6
#TOXENV=py26 %{__python} setup.py test
#%endif
%if 0%{?fedora}>=17
TOXENV=py27 %{__python} setup.py test
%endif
TOXENV=py27 %{__python2} setup.py test
TOXENV=py%{python3_version_nodots} %{__python3} setup.py test
%endif
%files
%files -n python2-%{pypiname}
%doc ISSUES.txt doc
%license LICENSE
%{python2_sitelib}/%{pypiname}
%{python2_sitelib}/%{pypiname}-%{version}-py2.?.egg-info
%files -n python3-%{pypiname}
%{_bindir}/%{pypiname}
%{_bindir}/%{pypiname}-quickstart
%{python_sitelib}/%{pypiname}
%{python_sitelib}/%{pypiname}-%{version}-py2.?.egg-info
%if 0%{?with_python3}
%files -n python3-tox
%{_bindir}/python3-%{pypiname}
%{_bindir}/python3-%{pypiname}-quickstart
%{python3_sitelib}/%{pypiname}
%{python3_sitelib}/%{pypiname}-%{version}-py%{python3_version}.egg-info
%endif
%changelog
* Thu Aug 11 2016 Miro Hrončok <mhroncok@redhat.com> - 2.3.1-3
- /usr/bin/tox is Python3
- Python 2 subpackage is python2-tox
- Run the tests also on Python 3
- Update Source URL and URL
- Use modern macros
- Get rid of Fedora 17 checks
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

Loading…
Cancel
Save