add python3 subpackage

This commit is contained in:
Matthias Runge 2015-01-15 11:14:18 +01:00
parent bebd34c74f
commit 83fb3a6012

View File

@ -1,9 +1,12 @@
# sitelib for noarch packages
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%if 0%{?fedora}
%global with_python3 1
%endif
Name: python-virtualenv
Version: 1.11.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Tool to create isolated Python environments
Group: Development/Languages
@ -13,13 +16,22 @@ Source0: http://pypi.python.org/packages/source/v/virtualenv/virtualenv-%
BuildArch: noarch
BuildRequires: python2-devel
Requires: python-setuptools
Requires: python2-devel
%if 0%{?fedora}
BuildRequires: python-sphinx
%endif
%if %{?with_python3}
BuildRequires: python3-devel
%if 0%{?fedora}
BuildRequires: python3-sphinx
%endif
%endif # with_python3
Requires: python-setuptools
Requires: python2-devel
%description
virtualenv is a tool to create isolated Python environments. virtualenv
@ -27,26 +39,63 @@ is a successor to workingenv, and an extension of virtual-python. It is
written by Ian Bicking, and sponsored by the Open Planning Project. It is
licensed under an MIT-style permissive license.
%if 0%{?with_python3}
%package -n python3-virtualenv
Summary: Tool to create isolated Python environments
Requires: python3-setuptools
Requires: python3-devel
%description -n python3-virtualenv
virtualenv is a tool to create isolated Python environments. virtualenv
is a successor to workingenv, and an extension of virtual-python. It is
written by Ian Bicking, and sponsored by the Open Planning Project. It is
licensed under an MIT-style permissive license
%endif # with_python3
%prep
%setup -q -n virtualenv-%{version}
%{__sed} -i -e "1s|#!/usr/bin/env python||" virtualenv.py
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build
# Build code
%{__python} setup.py build
%{__python2} setup.py build
# Build docs on Fedora
%if 0%{?fedora} > 0
%{__python} setup.py build_sphinx
%{__python2} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo
%endif
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
# Build docs on Fedora
%if 0%{?fedora} > 0
%{__python3} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo
%endif
popd
%endif # with_python3
%install
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
# rename binaries to use python3
mv %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/py3-virtualenv
popd
%endif # with_python3
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
%files
%doc docs/*rst PKG-INFO AUTHORS.txt LICENSE.txt
@ -55,11 +104,28 @@ rm -f build/sphinx/html/.buildinfo
%doc build/sphinx/*
%endif
%{python_sitelib}/*
%{_bindir}/virtualenv*
%{python2_sitelib}/*
%{_bindir}/virtualenv
%{_bindir}/virtualenv-%{python2_version}
%if 0%{?with_python3}
%files -n python3-virtualenv
%doc docs/*rst PKG-INFO AUTHORS.txt LICENSE.txt
# Include sphinx docs on Fedora
%if 0%{?fedora} > 0
%doc build/sphinx/*
%endif
%{_bindir}/py3-virtualenv
%{_bindir}/virtualenv-%{python3_version}
%{python3_sitelib}/*
%endif
%changelog
* Thu Jan 15 2015 Matthias Runge <mrunge@redhat.com> - 1.11.6-2
- add a python3-package, thanks to Matej Stuchlik (rhbz#1179150)
* Wed Jul 09 2014 Matthias Runge <mrunge@redhat.com> - 1.11.6-1
- update to 1.11.6:
Upstream updated setuptools to 3.6, updated pip to 1.5.6