Only have one /usr/bin/virtualenv (#1599422), provide "virtualenv" (#1502670)

epel9
Miro Hrončok 7 years ago
parent 65e6ab3c60
commit ca21f6720f

@ -1,11 +1,3 @@
# sitelib for noarch packages
%{!?__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_version: %global python2_version %(%{__python2} -c "import sys; sys.stdout.write(sys.version[:3])")}
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif
Name: python-virtualenv
Version: 16.0.0
Release: 5%{?dist}
@ -35,11 +27,8 @@ BuildArch: noarch
BuildRequires: git-core
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python2-sphinx
BuildRequires: python3-devel
BuildRequires: python3-sphinx
%endif # with_python3
# RPM installed wheels
BuildRequires: python-pip-wheel
@ -90,13 +79,6 @@ wheel that are required for virtualenv to create Python 2.6 virtual
environments.
%if 0%{?with_python3}
%package -n python-virtualenv-doc
Summary: Documentation for python virtualenv
%description -n python-virtualenv-doc
Documentation for python virtualenv.
%package -n python3-virtualenv
Summary: Tool to create isolated Python environments
@ -105,6 +87,12 @@ Requires: python3-devel
Requires: (python3-virtualenv-python26 = %{version}-%{release} if python26)
%{?python_provide:%python_provide python3-virtualenv}
# /usr/bin/virtualenv was moved (remove in F31)
Conflicts: python2-virtualenv < 16.0.0-5
# Provide "virtualenv" for convenience
Provides: virtualenv = %{version}-%{release}
# RPM installed wheels
Requires: python-pip-wheel
Requires: python-setuptools-wheel
@ -115,7 +103,6 @@ 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
%package -n python3-virtualenv-python26
@ -134,6 +121,14 @@ This package contains wheels of older versions of argparse, pip, setuptools and
wheel that are required for virtualenv to create Python 2.6 virtual
environments.
%package -n python-virtualenv-doc
Summary: Documentation for python virtualenv
%description -n python-virtualenv-doc
Documentation for python virtualenv.
%prep
%autosetup -p1 -S git -n virtualenv-%{version}
%{__sed} -i -e "1s|#!/usr/bin/env python||" virtualenv.py
@ -151,33 +146,19 @@ test $(ls virtualenv_support/*.whl -1 | wc -l) -eq 4
%build
# Build code
%{py2_build}
# Build docs on Fedora
%if 0%{?with_python3}
%{__python2} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo
%{py3_build}
# Build docs on Fedora
# Build docs
%{__python3} setup.py build_sphinx
rm -f build/sphinx/html/.buildinfo
%endif # with_python3
%install
%if 0%{?with_python3}
# As https://bugzilla.redhat.com/show_bug.cgi?id=1599422 we ship binaries in py3
%{py2_install}
rm %{buildroot}/%{_bindir}/virtualenv
%{py3_install}
# rename binaries to use python3
mv %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/py3-virtualenv
# The versioned 3.x script was removed from upstream. Add it back.
cp %{buildroot}/%{_bindir}/py3-virtualenv %{buildroot}/%{_bindir}/virtualenv-%{python3_version}
cp %{buildroot}/%{_bindir}/py3-virtualenv %{buildroot}/%{_bindir}/virtualenv-3
%endif # with_python3
%{py2_install}
# The versioned 2.x script was removed from upstream. Add it back.
cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-%{python2_version}
cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2
%files -n python2-virtualenv
%license LICENSE.txt
@ -187,15 +168,10 @@ cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2
%dir %{python2_sitelib}/virtualenv_support/
%{python2_sitelib}/virtualenv_support/__init__.py*
%{python2_sitelib}/virtualenv-*.egg-info/
%{_bindir}/virtualenv
%{_bindir}/virtualenv-2
%{_bindir}/virtualenv-%{python2_version}
%files -n python2-virtualenv-python26
%{python2_sitelib}/virtualenv_support/*.whl
%if 0%{?with_python3}
# Include sphinx docs on Fedora
%files -n python-virtualenv-doc
%doc build/sphinx/*
@ -203,9 +179,7 @@ cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2
%files -n python3-virtualenv
%license LICENSE.txt
%doc docs/*rst PKG-INFO AUTHORS.txt
%{_bindir}/py3-virtualenv
%{_bindir}/virtualenv-3
%{_bindir}/virtualenv-%{python3_version}
%{_bindir}/virtualenv
%{python3_sitelib}/virtualenv.py
%dir %{python3_sitelib}/virtualenv_support/
%{python3_sitelib}/virtualenv_support/__init__.py
@ -215,7 +189,6 @@ cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2
%files -n python3-virtualenv-python26
%{python3_sitelib}/virtualenv_support/*.whl
%endif
@ -223,6 +196,8 @@ cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2
* Wed Aug 15 2018 Miro Hrončok <mhroncok@redhat.com> - 16.0.0-5
- Use wheels from RPM packages
- Put wheels needed for Python 2.6 into a subpackage
- Only have one /usr/bin/virtualenv (#1599422)
- Provide "virtualenv" (#1502670)
* Wed Jul 18 2018 Miro Hrončok <mhroncok@redhat.com> - 16.0.0-4
- Reintroduce support for Python 2.6 (#1602347)

Loading…
Cancel
Save