- Use update-alternatives for parallel-installability with Python3 version

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-virtualenv?expand=0&rev=26
This commit is contained in:
Sascha Peilicke 2013-07-29 14:37:28 +00:00 committed by Git OBS Bridge
parent bda8666a2b
commit a2802a2992
2 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jul 29 14:39:38 UTC 2013 - speilicke@suse.com
- Use update-alternatives for parallel-installability with Python3 version
-------------------------------------------------------------------
Mon Jul 29 14:29:55 UTC 2013 - speilicke@suse.com

View File

@ -30,6 +30,8 @@ BuildRequires: python-devel
BuildRequires: python-Sphinx
Requires: python-pip
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
@ -64,15 +66,31 @@ rm virtualenv_support/*.gz # Remove in-tree libraries that are available as pac
%build
python setup.py build
python setup.py build_sphinx
python setup.py build_sphinx && rm build/sphinx/html/.buildinfo
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%pre
# Since /usr/bin/virtualenv became ghosted to be used with update-alternatives, we have to
# get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/virtualenv ]] && rm -f %{_bindir}/virtualenv
exit 0
%post
update-alternatives \
--install %{_bindir}/virtualenv virtualenv %{_bindir}/virtualenv-%{py_ver} 20
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove virtualenv %{_bindir}/virtualenv-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.rst build/sphinx/html
%{_bindir}/virtualenv*
%ghost %{_bindir}/virtualenv
%{_bindir}/virtualenv-%{py_ver}
%{python_sitelib}/virtualenv*
%changelog