diff --git a/0001-Python-3-default-binaries.patch b/0001-Python-3-default-binaries.patch new file mode 100644 index 0000000..f2adfc7 --- /dev/null +++ b/0001-Python-3-default-binaries.patch @@ -0,0 +1,58 @@ +From 01352fd3531c768593cf7c1282fb5fdfc52f042d Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Mon, 19 Mar 2018 14:50:47 +0100 +Subject: [PATCH] Python 3 default binaries + +--- + virtualenvwrapper.sh | 6 +++--- + virtualenvwrapper_lazy.sh | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/virtualenvwrapper.sh b/virtualenvwrapper.sh +index 9c0b1ac..d21becf 100644 +--- a/virtualenvwrapper.sh ++++ b/virtualenvwrapper.sh +@@ -47,19 +47,19 @@ + # Locate the global Python where virtualenvwrapper is installed. + if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ] + then +- VIRTUALENVWRAPPER_PYTHON="$(command \which python)" ++ VIRTUALENVWRAPPER_PYTHON="$(command \which python3)" + fi + + # Set the name of the virtualenv app to use. + if [ "${VIRTUALENVWRAPPER_VIRTUALENV:-}" = "" ] + then +- VIRTUALENVWRAPPER_VIRTUALENV="virtualenv" ++ VIRTUALENVWRAPPER_VIRTUALENV="virtualenv-3" + fi + + # Set the name of the virtualenv-clone app to use. + if [ "${VIRTUALENVWRAPPER_VIRTUALENV_CLONE:-}" = "" ] + then +- VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone" ++ VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone-3" + fi + + # Define script folder depending on the platorm (Win32/Unix) +diff --git a/virtualenvwrapper_lazy.sh b/virtualenvwrapper_lazy.sh +index 3902d08..da54c4b 100644 +--- a/virtualenvwrapper_lazy.sh ++++ b/virtualenvwrapper_lazy.sh +@@ -5,11 +5,11 @@ export _VIRTUALENVWRAPPER_API="$_VIRTUALENVWRAPPER_API mkvirtualenv rmvirtualenv + + if [ -z "$VIRTUALENVWRAPPER_SCRIPT" ] + then +- export VIRTUALENVWRAPPER_SCRIPT="$(command \which virtualenvwrapper.sh)" ++ export VIRTUALENVWRAPPER_SCRIPT="$(command \which virtualenvwrapper-3.sh)" + fi + if [ -z "$VIRTUALENVWRAPPER_SCRIPT" ] + then +- echo "ERROR: virtualenvwrapper_lazy.sh: Could not find virtualenvwrapper.sh" 1>&2 ++ echo "ERROR: virtualenvwrapper_lazy-3.sh: Could not find virtualenvwrapper-3.sh" 1>&2 + fi + + # Load the real implementation of the API from virtualenvwrapper.sh +-- +2.14.3 + diff --git a/python-virtualenvwrapper.spec b/python-virtualenvwrapper.spec index 346ece9..d7adb15 100644 --- a/python-virtualenvwrapper.spec +++ b/python-virtualenvwrapper.spec @@ -8,13 +8,14 @@ one project at a time without introducing conflicts in their dependencies. Name: python-%{modname} Version: 4.8.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: %{sum} Group: Development/Languages License: MIT URL: https://pypi.python.org/pypi/%{modname} Source0: https://pypi.python.org/packages/source/v/%{modname}/%{modname}-%{version}.tar.gz +Patch0: 0001-Python-3-default-binaries.patch BuildArch: noarch @@ -45,6 +46,7 @@ Summary: %{sum} Requires: python2-virtualenv Requires: python2-virtualenv-clone Requires: python2-stevedore +Requires: which %{?python_provide:%python_provide python2-%{modname}} %description -n python2-%{modname} @@ -56,6 +58,7 @@ Summary: %{sum} Requires: python3-virtualenv Requires: python3-virtualenv-clone Requires: python3-stevedore +Requires: which %{?python_provide:%python_provide python3-%{modname}} %description -n python3-%{modname} @@ -64,6 +67,14 @@ Requires: python3-stevedore %prep %setup -q -n %{modname}-%{version} rm -rf %{modname}.egg-info +# Copy default shell script +cp %{modname}.sh %{modname}-2.sh +cp %{modname}_lazy.sh %{modname}_lazy-2.sh +# Fix default binaries +patch -p1 < %{PATCH0} +# Copy patched version +cp %{modname}.sh %{modname}-3.sh +cp %{modname}_lazy.sh %{modname}_lazy-3.sh %build %py2_build @@ -73,8 +84,22 @@ rm -rf %{modname}.egg-info %py2_install %py3_install +# Install both versions of shell scripts +install -m 0755 %{modname}-2.sh %{buildroot}/%{_bindir}/%{modname}-2.sh +install -m 0755 %{modname}-3.sh %{buildroot}/%{_bindir}/%{modname}-3.sh +install -m 0755 %{modname}_lazy-2.sh %{buildroot}/%{_bindir}/%{modname}_lazy-2.sh +install -m 0755 %{modname}_lazy-3.sh %{buildroot}/%{_bindir}/%{modname}_lazy-3.sh + +# Remove installed version +rm %{buildroot}/%{_bindir}/%{modname}.sh +rm %{buildroot}/%{_bindir}/%{modname}_lazy.sh +# And make backwards compatible symlinks +ln -s %{_bindir}/%{modname}-2.sh %{buildroot}/%{_bindir}/%{modname}.sh +ln -s %{_bindir}/%{modname}_lazy-2.sh %{buildroot}/%{_bindir}/%{modname}_lazy.sh + %{__mkdir_p} %{buildroot}/%{_sysconfdir}/profile.d/ -ln -s %{_bindir}/virtualenvwrapper_lazy.sh %{buildroot}/%{_sysconfdir}/profile.d/virtualenvwrapper.sh +ln -s %{_bindir}/virtualenvwrapper_lazy-2.sh %{buildroot}/%{_sysconfdir}/profile.d/virtualenvwrapper.sh +ln -s %{_bindir}/virtualenvwrapper_lazy-3.sh %{buildroot}/%{_sysconfdir}/profile.d/virtualenvwrapper-3.sh #%%check # Tests won't fly in koji since they try to install stuff from pypi @@ -85,18 +110,23 @@ ln -s %{_bindir}/virtualenvwrapper_lazy.sh %{buildroot}/%{_sysconfdir}/profile.d %{python2_sitelib}/%{modname} %{python2_sitelib}/%{modname}-%{version}* %{_bindir}/virtualenvwrapper.sh +%{_bindir}/virtualenvwrapper-2.sh %{_bindir}/virtualenvwrapper_lazy.sh +%{_bindir}/virtualenvwrapper_lazy-2.sh %config(noreplace) %{_sysconfdir}/profile.d/virtualenvwrapper.sh %files -n python3-%{modname} %doc PKG-INFO docs %{python3_sitelib}/%{modname} %{python3_sitelib}/%{modname}-%{version}* -%{_bindir}/virtualenvwrapper.sh -%{_bindir}/virtualenvwrapper_lazy.sh -%config(noreplace) %{_sysconfdir}/profile.d/virtualenvwrapper.sh +%{_bindir}/virtualenvwrapper-3.sh +%{_bindir}/virtualenvwrapper_lazy-3.sh +%config(noreplace) %{_sysconfdir}/profile.d/virtualenvwrapper-3.sh %changelog +* Mon Mar 19 2018 Lumír Balhar - 4.8.2-3 +- Separated scripts for different Python versions + * Fri Feb 09 2018 Igor Gnatenko - 4.8.2-2 - Escape macros in %%changelog