#
# spec file for package python-virtualenv
#
# Copyright (c) 2015 SUSE LINUX 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
Version:        12.0.7
Release:        51.27
Url:            http://www.virtualenv.org/
Summary:        Virtual Python Environment builder
License:        MIT
Group:          Development/Languages/Python
Source:         https://pypi.python.org/packages/source/v/virtualenv/virtualenv-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python-devel
# Documentation requirements
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
BuildArch:      noarch
%endif

%description
virtualenv is a tool to create isolated Python environments.
The basic problem being addressed is one of dependencies and versions, and
indirectly permissions. Imagine you have an application that needs version 1
of LibFoo, but another application requires version 2. How can you use both
these applications? If you install everything into
/usr/lib/python2.4/site-packages (or whatever your platforms standard location
is), its easy to end up in a situation where you unintentionally upgrade an
application that shouldnt be upgraded.

Or more generally, what if you want to install an application and leave it be?
If an application works, any change in its libraries or the versions of those
libraries can break the application.

Also, what if you cant install packages into the global site-packages
directory? For instance, on a shared host.

In all these cases, virtualenv can help you. It creates an environment that
has its own installation directories, that doesnt share libraries with other
virtualenv environments (and optionally doesnt use the globally installed
libraries either).

%prep
%setup -q -n virtualenv-%{version}

%build
python setup.py build
#python setup.py build_sphinx && rm build/sphinx/html/.buildinfo

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Remove script copy and replace with symlink to please u-a:
rm %{buildroot}%{_bindir}/virtualenv
ln -s %{_bindir}/virtualenv-%{py_ver} %{buildroot}%{_bindir}/virtualenv

%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:
[ -h %{_bindir}/virtualenv ] || rm -f %{_bindir}/virtualenv

%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
%{_bindir}/virtualenv-%{py_ver}
%{python_sitelib}/virtualenv*
%if 0%{?suse_version} >= 1230
%ghost %{_sysconfdir}/alternatives/virtualenv
%endif

%changelog
* Thu Apr  2 2015 benoit.monin@gmx.fr
- update to version 12.0.7:
  * Upgrade pip to 6.0.8
- additional changes from version 12.0.6:
  * Upgrade pip to 6.0.7
  * Upgrade setuptools to 12.0.5
- additional changes from version 12.0.5:
  * Upgrade pip to 6.0.6
  * Upgrade setuptools to 11.0
- additional changes from version 12.0.4:
  * Revert the fix to ``-p`` on Debian based pythons as it was
    broken in other situations.
  * Revert several sys.path changes new in 12.0 which were breaking
    virtualenv.
- additional changes from version 12.0.3:
  * Fix an issue where Debian based Pythons would fail when using
  - p with the host Python.
  * Upgrade pip to 6.0.3
- additional changes from version 12.0.2:
  * Upgraded pip to 6.0.2
- additional changes from version 12.0.1:
  * Upgraded pip to 6.0.1
- additional changes from version 12.0:
  * **PROCESS** Version numbers are now simply ``X.Y`` where the
    leading ``1`` has been dropped.
  * Split up documentation into structured pages
  * Now using pytest framework
  * Correct sys.path ordering for debian, issue #461
  * Correctly throws error on older Pythons, issue #619
  * Allow for empty $PATH, pull #601
  * Don't set prompt if $env:VIRTUAL_ENV_DISABLE_PROMPT is set for
    Powershell
  * Updated setuptools to 7.0
* Sat Nov  8 2014 Led <ledest@gmail.com>
- fix bashism in pre script
* Tue Sep 16 2014 tbechtold@suse.com
- update to version 1.11.6
  * Updated setuptools to 3.6
  * Updated pip to 1.5.6
  * Updated documentation to use https://virtualenv.pypa.io/
* Sun Mar 30 2014 toddrme2178@gmail.com
- update to 1.11.4
  * Updated pip to 1.5.4
- update to 1.11.3
  * Updated setuptools to 2.2
  * Updated pip to 1.5.3
* Tue Feb 11 2014 dmueller@suse.com
- update to 1.11.2:
  * Fixed easy_install installed virtualenvs by updated pip to 1.5.2
  * Fixed an issue where pip and setuptools were not getting installed when using
  the ``--system-site-packages`` flag.
  * Updated setuptools to fix an issue when installed with easy_install
  * Fixed an issue with Python 3.4 and sys.stdout encoding being set to ascii
* Tue Jan  7 2014 speilicke@suse.com
- Update to version 1.11:
  + BACKWARDS INCOMPATIBLE Switched to using wheels for the bundled
    copies of setuptools and pip. Using sdists is no longer supported
  + BACKWARDS INCOMPATIBLE Modified the handling of --extra-search-dirs.
    This option now works like pip’s --find-links option, in that it
    adds extra directories to search for compatible wheels for pip and
    setuptools. The actual wheel selected is chosen based on version
    and compatibility, using the same algorithm as pip install setuptools.
  + Upgraded pip to v1.5
  + Upgraded setuptools to v1.4
- Symlink /usr/bin/virtualenv in buildroot (u-a warning) and ghost
  alternatives link on 12.3 or newer
* Fri Oct 11 2013 speilicke@suse.com
- Update to version 1.10.1:
  + **New Signing Key** Release 1.10.1 is using a different key than normal with
    fingerprint: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
  + Upgraded pip to v1.4.1
  + Upgraded setuptools to v0.9.8
* Mon Jul 29 2013 speilicke@suse.com
- Don't drop shipped setuptools / pip, they've been fetched from the
  interwebs previously. It doesn't make sense to use the (currently
  matching) system equivalents, it's meant to be self-contained
* Mon Jul 29 2013 speilicke@suse.com
- Use update-alternatives for parallel-installability with Python3 version
* Mon Jul 29 2013 speilicke@suse.com
- Update to version 1.10:
  + BACKWARDS INCOMPATIBLE Dropped support for Python 2.5. The minimum supported
    Python version is now Python 2.6.
  + BACKWARDS INCOMPATIBLE Using virtualenv.py as an isolated script (i.e.
    without an associated virtualenv_support directory) is no longer supported
    for security reasons and will fail with an error.
  + Along with this, --never-download is now always pinned to True, and is only
    being maintained in the short term for backward compatibility (Pull #412).
  + IMPORTANT Switched to the new setuptools (v0.9.7) which has been merged with
    Distribute again and works for Python 2 and 3 with one codebase. The
  - -distribute and --setuptools options are now no-op.
  + Updated to pip 1.4.
  + Added support for PyPy3k
  + Added the option to use a version number with the -p option to get the system
    copy of that Python version (Windows only)
  + Removed embedded ez_setup.py, distribute_setup.py and distribute_from_egg.py
    files as part of switching to merged setuptools.
  + Fixed --relocatable to work better on Windows.
  + Fixed issue with readline on Windows.
- Spec clean:
  + Depend on setuptools instead of distribute again
  + Package README.rst
  + Build HTML documentation and install it (instead of sources)
* Fri Mar  8 2013 alexandre@exatati.com.br
- Update to 1.9.1:
  * Updated to pip 1.3.1 that fixed a major backward incompatible
    change of parsing URLs to externally hosted packages that got
    accidentily included in pip 1.3.
- Aditional changes from 1.9
  * Unset VIRTUAL_ENV environment variable in deactivate.bat
    (Pull #364)
  * Upgraded distribute to 0.6.34.
  * Added --no-setuptools and --no-pip options (Pull #336).
  * Fixed Issue #373. virtualenv-1.8.4 was failing in cygwin
    (Pull #382).
  * Fixed Issue #378. virtualenv is now "multiarch" aware on
    debian/ubuntu (Pull #379).
  * Fixed issue with readline module path on pypy and OSX (Pull #374).
  * Made 64bit detection compatible with Python 2.5 (Pull #393).
* Tue Nov 27 2012 alexandre@exatati.com.br
- Update to 1.8.4:
  - Updated distribute to 0.6.31. This fixes #359 (numpy install
    regression) on UTF-8 platforms, and provides a workaround on
    other platforms: PYTHONIOENCODING=utf8 pip install numpy.
  - When installing virtualenv via curl, don't forget to filter
    out arguments the distribute setup script won't understand.
    Fixes #358.
  - Added some more integration tests.
* Sun Nov 25 2012 alexandre@exatati.com.br
- Update to 1.8.3:
  - Fixed readline on OS X. Thanks minrk
  - Updated distribute to 0.6.30 (improves our error reporting,
    plus new distribute features and fixes). Thanks Gabriel (g2p)
  - Added compatibility with multiarch Python (Python 3.3 for example).
    Added an integration test. Thanks Gabriel (g2p)
  - Added ability to install distribute from a user-provided egg,
    rather than the bundled sdist, for better speed. Thanks Paul Moore.
  - Make the creation of lib64 symlink smarter about already-existing
    symlink, and more explicit about full paths. Fixes #334 and #330.
    Thanks Jeremy Orem.
  - Give lib64 site-dir preference over lib on 64-bit systems, to
    avoid wrong 32-bit compiles in the venv. Fixes #328. Thanks Damien
    Nozay.
  - Fix a bug with prompt-handling in activate.csh in non-interactive
    csh shells. Fixes #332. Thanks Benjamin Root for report and patch.
  - Make it possible to create a virtualenv from within a Python 3.3
    pyvenv. Thanks Chris McDonough for the report.
  - Add optional --setuptools option to be able to switch to it in
    case distribute is the default (like in Debian).
* Thu Sep  6 2012 alexandre@exatati.com.br
- Update to 1.8.2:
  * Updated the included pip version to 1.2.1 to fix regressions
    introduced there in 1.2.
* Mon Sep  3 2012 alexandre@exatati.com.br
- Update to 1.8.1:
  * Fixed distribute version used with --never-download. Thanks
    michr for report and patch.
  * Fix creating Python 3.3 based virtualenvs by unsetting the
    __PYVENV_LAUNCHER__ environment variable in subprocesses.
* Sat Sep  1 2012 alexandre@exatati.com.br
- Update to 1.8:
  - Dropped support for Python 2.4 The minimum supported Python
    version is now Python 2.5.
  - Fix --relocatable on systems that use lib64. Fixes #78. Thanks
    Branden Rolston.
  - Symlink some additional modules under Python 3. Fixes #194.
    Thanks Vinay Sajip, Ian Clelland, and Stefan Holek for the report.
  - Fix --relocatable when a script uses __future__ imports. Thanks
    Branden Rolston.
  - Fix a bug in the config option parser that prevented setting
    negative options with environemnt variables. Thanks Ralf Schmitt.
  - Allow setting --no-site-packages from the config file.
  - Use /usr/bin/multiarch-platform if available to figure out the
    include directory. Thanks for the patch, Mika Laitio.
  - Fix install_name_tool replacement to work on Python 3.X.
  - Handle paths of users' site-packages on Mac OS X correctly
    when changing the prefix.
  - Updated the embedded version of distribute to 0.6.28 and pip
    to 1.2.
* Fri Jun 22 2012 alexandre@exatati.com.br
- Update to 1.7.2:
  - Updated to distribute 0.6.27.
  - Fix activate.fish on OS X. Fixes #8. Thanks David Schoonover.
  - Create a virtualenv-x.x script with the Python version when
    installing, so virtualenv for multiple Python versions can be
    installed to the same script location. Thanks Miki Tebeka.
  - Restored ability to create a virtualenv with a path longer than
    78 characters, without breaking creation of virtualenvs with
    non-ASCII paths. Thanks, Bradley Ayers.
  - Added ability to create virtualenvs without having installed
    Apple's developers tools (using an own implementation of
    install_name_tool). Thanks Mike Hommey.
  - Fixed PyPy and Jython support on Windows. Thanks Konstantin
    Zemlyak.
  - Added pydoc script to ease use. Thanks Marc Abramowitz. Fixes
    [#149].
  - Fixed creating a bootstrap script on Python 3. Thanks Raul
    Leal. Fixes #280.
  - Fixed inconsistency when having set the PYTHONDONTWRITEBYTECODE
    env var with the --distribute option or the
    VIRTUALENV_USE_DISTRIBUTE env var. VIRTUALENV_USE_DISTRIBUTE
    is now considered again as a legacy alias.
* Fri Feb 17 2012 alexandre@exatati.com.br
- Update to 1.7.1.2:
  * Fixed minor issue in --relocatable. Thanks, Cap Petschulat.
- Aditional changes from 1.7.1.1:
  * Bumped the version string in virtualenv.py up, too.
  * Fixed rST rendering bug of long description.
* Wed Nov 30 2011 alexandre@exatati.com.br
- Update to 1.7:
  - Updated embedded Distribute release to 0.6.24. Thanks Alex
    Grönholm.
  - Made --no-site-packages behavior the default behavior. The
  - -no-site-packages flag is still permitted, but displays a
    warning when used. Thanks Chris McDonough.
  - New flag: --system-site-packages; this flag should be passed
    to get the previous default global-site-package-including
    behavior back.
  - Added ability to set command options as environment variables
    and options in a virtualenv.ini file.
  - Fixed various encoding related issues with paths. Thanks
    Gunnlaugur Thor Briem.
  - Made virtualenv.py script executable.
* Thu Jul 21 2011 alexandre@exatati.com.br
- Update to 1.6.4:
  * Restored ability to run on Python 2.4, too.
* Tue Jul 19 2011 saschpe@suse.de
- Spec file cleanup:
  * Remove she-bang line from non-executable script (rpmlint warning)
  * Remove in-tree libraries (setuptools, pip & distribute)
  * Don't package PKG-INFO but AUTHORS.txt and LICENSE.txt
* Sun Jul 17 2011 alexandre@exatati.com.br
- Update to 1.6.3:
  * Restored ability to run on Python < 2.7.
- Aditional changes from 1.6.2:
  * Updated embedded distribute release to 0.6.19.
  * Updated embedded pip release to 1.0.2.
  * Fixed #141 - Be smarter about finding pkg_resources when using the
    non-default Python intepreter (by using the -p option).
  * Fixed #112 - Fixed path in docs.
  * Fixed #109 - Corrected doctests of a Logger method.
  * Fixed #118 - Fixed creating virtualenvs on platforms that use the
    "posix_local" install scheme, such as Ubuntu with Python 2.7.
  * Add missing library to Python 3 virtualenvs (_dummy_thread).
* Mon May  2 2011 alexandre@exatati.com.br
- Update to 1.6.1:
  * Start to use git-flow.
  * Added support for PyPy 1.5
  * Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
  * Added progress meter for pip installation as well as setuptools. Thanks Ethan
    Jucovy.
  * Added --never-download and --search-dir options. Thanks Ethan Jucovy.
* Wed Apr 13 2011 alexandre@exatati.com.br
- Update to 1.6:
  * Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
  * Fixed creation of virtualenvs on Mac OS X when standard library modules
    (readline) are installed outside the standard library.
  * Updated bundled pip to 1.0.
- Regenerate spec file with py2pack.
* Sun Sep 19 2010 alexandre@exatati.com.br
- Update to 1.5.1:
  - Added ``_weakrefset`` requirement for Python 2.7.1.
  - Fixed Windows regression in 1.5.
* Wed Sep 15 2010 alexandre@exatati.com.br
- Update to 1.5:
  - Include pip 0.8.1.
  - Add support for PyPy.
  - Uses a proper temporary dir when installing environment requirements.
  - Add --prompt option to be able to override the default prompt prefix.
  - Fix an issue with --relocatable on Windows.
  - Fix issue with installing the wrong version of distribute.
  - Add fish and csh activate scripts.
* Fri May 28 2010 alexandre@exatati.com.br
- Update to 1.4.9:
  * Include pip 0.7.2.
* Fri Apr 23 2010 alexandre@exatati.com.br
- Update to 1.4.8:
  * Fix for Mac OS X Framework builds that use
    ``--universal-archs=intel``
  * Fix ``activate_this.py`` on Windows.
  * Allow ``$PYTHONHOME`` to be set, so long as you use ``source
    bin/activate`` it will get unset; if you leave it set and do not
    activate the environment it will still break the environment.
  * Include pip 0.7.1.
* Mon Apr 19 2010 alexandre@exatati.com.br
- Update to 1.4.7:
  * Include pip 0.7.
* Wed Mar 31 2010 alexandre@exatati.com.br
- Update to 1.4.6
  * Allow ``activate.sh`` to skip updating the prompt (by setting
    ``$VIRTUAL_ENV_DISABLE_PROMPT``).
- Spec file cleaned with spec-cleaner.
* Mon Mar 15 2010 alexandre@exatati.com.br
- Added python-setuptools as Requires;
- Generated changes file from spec file;
- Removed old tarballs;
- Update to 1.4.5
  - Include pip 0.6.3
- Aditional changes from 1.4.4:
  - Include pip 0.6.2 and Distribute 0.6.10
  - Create the virtualenv script even when Setuptools isn’t installed
  - Fix problem with virtualenv --relocate when bin/ has subdirectories
    (e.g., bin/.svn/); from Alan Franzoni.
  - If you set $VIRTUALENV_USE_DISTRIBUTE then virtualenv will use
    Distribute by default (so you don’t have to remember to use --distribute).
* Sat Nov 21 2009 cfarrell1980@gmail.com
- 1.4.3
  * Include pip 0.6.1
* Mon Nov  9 2009 cfarrell1980@gmail.com
- Update to 1.4
  * Updated setuptools to 0.6c11
  * Added the --distribute option
  * Fixed packaging problem of support-files
* Tue Mar  3 2009 cfarrell1980@gmail.com
- Update to 1.3.2
  - Remove the [install] prefix = ... setting from virtualenv distutils.cfg as has been causing problems for a lot of people, in rather obscure ways.
  - If you use a boot script it will attempt to import virtualenv and find a pre-downloaded Setuptools egg using that.
  - Added platform-specific paths, like /usr/lib/pythonX.Y/plat-linux2
* Wed Nov  5 2008 cfarrell1980@gmail.com
- Initial import and build - 1.3