forked from pool/python-virtualenv-clone
Fix update-alternatives as requested. OBS-URL: https://build.opensuse.org/request/show/264552 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-virtualenv-clone?expand=0&rev=6
105 lines
3.8 KiB
RPMSpec
105 lines
3.8 KiB
RPMSpec
#
|
|
# spec file for package python-virtualenv-clone
|
|
#
|
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
Name: python-virtualenv-clone
|
|
Version: 0.2.5
|
|
Release: 0
|
|
Summary: Script to clone virtualenvs
|
|
License: MIT
|
|
Group: Development/Languages/Python
|
|
Url: http://github.com/edwardgeorge/virtualenv-clone
|
|
Source: virtualenv-clone-%{version}.tar.gz
|
|
BuildRequires: python-devel
|
|
BuildRequires: python-setuptools
|
|
Recommends: python-virtualenv
|
|
Requires(post): update-alternatives
|
|
Requires(postun): update-alternatives
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
%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
|
|
BuildArch: noarch
|
|
%endif
|
|
|
|
%description
|
|
virtualenv cloning script.
|
|
|
|
A script for cloning a non-relocatable virtualenv.
|
|
|
|
Virtualenv provides a way to make virtualenv's relocatable which could then be
|
|
copied as we wanted. However making a virtualenv relocatable this way breaks
|
|
the no-site-packages isolation of the virtualenv as well as other aspects that
|
|
come with relative paths and '/usr/bin/env' shebangs that may be undesirable.
|
|
|
|
Also, the .pth and .egg-link rewriting doesn't seem to work as intended. This
|
|
attempts to overcome these issues and provide a way to easily clone an
|
|
existing virtualenv.
|
|
|
|
It performs the following:
|
|
|
|
- copies sys.argv[1] dir to sys.argv[2]
|
|
- updates the hardcoded VIRTUAL_ENV variable in the activate script to the
|
|
new repo location. (--relocatable doesn't touch this)
|
|
- updates the shebangs of the various scripts in bin to the new python if
|
|
they pointed to the old python. (version numbering is retained.)
|
|
|
|
it can also change '/usr/bin/env python' shebangs to be absolute too,
|
|
though this functionality is not exposed at present.
|
|
|
|
- checks sys.path of the cloned virtualenv and if any of the paths are from
|
|
the old environment it finds any .pth or .egg-link files within sys.path
|
|
located in the new environment and makes sure any absolute paths to the
|
|
old environment are updated to the new environment.
|
|
|
|
- finally it double checks sys.path again and will fail if there are still
|
|
paths from the old environment present.
|
|
|
|
%prep
|
|
%setup -q -n virtualenv-clone-%{version}
|
|
|
|
%build
|
|
python setup.py build
|
|
|
|
%install
|
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
|
|
|
# setup up update-alternatives
|
|
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
|
touch %{buildroot}%{_sysconfdir}/alternatives/virtualenv-clone
|
|
mv %{buildroot}%{_bindir}/virtualenv-clone %{buildroot}%{_bindir}/virtualenv-clone-%{py_ver}
|
|
ln -sf %{_sysconfdir}/alternatives/virtualenv-clone %{buildroot}/%{_bindir}/virtualenv-clone
|
|
|
|
%post
|
|
update-alternatives \
|
|
--install %{_bindir}/virtualenv-clone virtualenv-clone %{_bindir}/virtualenv-clone-%{py_ver} 30
|
|
|
|
%postun
|
|
if [ $1 -eq 0 ] ; then
|
|
update-alternatives --remove virtualenv-clone %{_bindir}/virtualenv-clone-%{py_ver}
|
|
fi
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%doc LICENSE README
|
|
%{_bindir}/virtualenv-clone
|
|
%{_bindir}/virtualenv-clone-%{py_ver}
|
|
%ghost %{_sysconfdir}/alternatives/virtualenv-clone
|
|
%{python_sitelib}/*
|
|
|
|
%changelog
|