summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2016-01-19 19:55:31 -0500
committerDonald Stufft <donald@stufft.io>2016-01-19 19:55:31 -0500
commit4ac44d2a1508e86d78e06fa158373e723f3b4dcb (patch)
treebdcd6e4b760bf325d4f079a8f4c1612927df4cf4
parent134c9a6c67081cda67befd61bae68a999ed00f48 (diff)
parent130399fdd13152d09e5cb133bf72abd95dc7e5b0 (diff)
downloadvirtualenv-4ac44d2a1508e86d78e06fa158373e723f3b4dcb.tar.gz
Merge branch 'develop'14.0.0
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore6
-rw-r--r--.travis.yml29
-rw-r--r--LICENSE.txt2
-rw-r--r--MANIFEST.in5
-rw-r--r--README.rst14
-rwxr-xr-xbin/rebuild-script.py88
-rw-r--r--docs/changes.rst60
-rw-r--r--docs/conf.py8
-rw-r--r--docs/index.rst4
-rw-r--r--docs/reference.rst13
-rw-r--r--docs/userguide.rst11
-rw-r--r--setup.py30
-rwxr-xr-xtests/test_activate.sh4
-rw-r--r--tests/test_activate_output.expected (renamed from tests/test_activate_expected.output)2
-rw-r--r--tests/test_virtualenv.py32
-rw-r--r--tests/tox.ini12
-rw-r--r--tox.ini8
-rwxr-xr-xvirtualenv.py574
-rw-r--r--virtualenv_embedded/activate.bat56
-rw-r--r--virtualenv_embedded/activate.csh8
-rw-r--r--virtualenv_embedded/activate.fish68
-rw-r--r--virtualenv_embedded/activate.sh32
-rw-r--r--virtualenv_embedded/deactivate.bat19
-rw-r--r--virtualenv_embedded/python-config78
-rw-r--r--virtualenv_support/argparse-1.3.0-py2.py3-none-any.whlbin22545 -> 0 bytes
-rw-r--r--virtualenv_support/argparse-1.4.0-py2.py3-none-any.whlbin0 -> 23000 bytes
-rw-r--r--virtualenv_support/pip-8.0.0-py2.py3-none-any.whl (renamed from virtualenv_support/pip-7.1.2-py2.py3-none-any.whl)bin1111358 -> 1188709 bytes
-rw-r--r--virtualenv_support/setuptools-19.4-py2.py3-none-any.whl (renamed from virtualenv_support/setuptools-18.2-py2.py3-none-any.whl)bin461713 -> 471943 bytes
-rw-r--r--virtualenv_support/wheel-0.26.0-py2.py3-none-any.whl (renamed from virtualenv_support/wheel-0.24.0-py2.py3-none-any.whl)bin63270 -> 63454 bytes
30 files changed, 618 insertions, 546 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..86c9df4
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+virtualenv_embedded/*.bat text eol=crlf \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 6a79b83..caf0827 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,8 @@ build
dist
docs/_build
.DS_Store
-*.pyc
-mock-*.egg
-nose-*.egg
+*.py[cod]
+*.egg
+.eggs
.tox
tests/test_activate_actual.output
diff --git a/.travis.yml b/.travis.yml
index 0787906..b89e5d8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,30 @@
language: python
-env:
- - TOXENV=py26
- - TOXENV=py27
- - TOXENV=py32
- - TOXENV=py33
- - TOXENV=py34
- - TOXENV=pypy
- - TOXENV=pypy3
- - TOXENV=docs
+matrix:
+ include:
+ - python: 2.6
+ env: TOXENV=py26
+ - python: 2.7
+ env: TOXENV=py27
+ - python: 3.3
+ env: TOXENV=py33
+ - python: 3.4
+ env: TOXENV=py34
+ - python: 3.5
+ env: TOXENV=py35
+ - python: pypy
+ env: TOXENV=pypy
+ - python: pypy3
+ env: TOXENV=pypy3
+ - python: 2.7
+ env: TOXENV=docs
install: pip install tox
script: tox
+sudo: false # Use container based builds
+
branches:
only:
- master
diff --git a/LICENSE.txt b/LICENSE.txt
index 7e00d5d..a84d8dd 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,6 +1,6 @@
Copyright (c) 2007 Ian Bicking and Contributors
Copyright (c) 2009 Ian Bicking, The Open Planning Project
-Copyright (c) 2011-2014 The virtualenv developers
+Copyright (c) 2011-2015 The virtualenv developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/MANIFEST.in b/MANIFEST.in
index 62621c8..49037ad 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,11 +1,12 @@
-recursive-include bin *
recursive-include docs *
-recursive-include scripts *
+recursive-include tests *.py *.sh *.expected
recursive-include virtualenv_support *.whl
recursive-include virtualenv_embedded *
recursive-exclude docs/_templates *
recursive-exclude docs/_build *
include virtualenv_support/__init__.py
+include bin/*
+include scripts/*
include *.py
include AUTHORS.txt
include LICENSE.txt
diff --git a/README.rst b/README.rst
index 5a7a545..c782228 100644
--- a/README.rst
+++ b/README.rst
@@ -1,10 +1,20 @@
virtualenv
==========
-.. image:: https://pypip.in/v/virtualenv/badge.png
+.. image:: https://img.shields.io/pypi/v/virtualenv.svg
:target: https://pypi.python.org/pypi/virtualenv
-.. image:: https://secure.travis-ci.org/pypa/virtualenv.png?branch=develop
+.. image:: https://img.shields.io/travis/pypa/virtualenv/develop.svg
:target: http://travis-ci.org/pypa/virtualenv
For documentation, see https://virtualenv.pypa.io/
+
+
+Code of Conduct
+---------------
+
+Everyone interacting in the virtualenv project's codebases, issue trackers,
+chat rooms, and mailing lists is expected to follow the
+`PyPA Code of Conduct`_.
+
+.. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/
diff --git a/bin/rebuild-script.py b/bin/rebuild-script.py
index 44fb129..a816af3 100755
--- a/bin/rebuild-script.py
+++ b/bin/rebuild-script.py
@@ -2,70 +2,72 @@
"""
Helper script to rebuild virtualenv.py from virtualenv_support
"""
+from __future__ import print_function
-import re
import os
-import sys
+import re
+import codecs
+from zlib import crc32
here = os.path.dirname(__file__)
script = os.path.join(here, '..', 'virtualenv.py')
+gzip = codecs.lookup('zlib')
+b64 = codecs.lookup('base64')
+
file_regex = re.compile(
- r'##file (.*?)\n([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*convert\("""(.*?)"""\)',
+ br'##file (.*?)\n([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*convert\("""\n(.*?)"""\)',
re.S)
-file_template = '##file %(filename)s\n%(varname)s = convert("""\n%(data)s""")'
+file_template = b'##file %(filename)s\n%(varname)s = convert("""\n%(data)s""")'
-def rebuild():
- f = open(script, 'rb')
- content = f.read()
- f.close()
+def rebuild(script_path):
+ with open(script_path, 'rb') as f:
+ script_content = f.read()
parts = []
last_pos = 0
match = None
- for match in file_regex.finditer(content):
- parts.append(content[last_pos:match.start()])
+ for match in file_regex.finditer(script_content):
+ parts += [script_content[last_pos:match.start()]]
last_pos = match.end()
- filename = match.group(1)
+ filename, fn_decoded = match.group(1), match.group(1).decode()
varname = match.group(2)
data = match.group(3)
- print('Found reference to file %s' % filename)
- pathname = os.path.join(here, '..', 'virtualenv_embedded', filename)
- f = open(pathname, 'rb')
- c = f.read()
- f.close()
- new_data = c.encode('zlib').encode('base64')
+
+ print('Found file %s' % fn_decoded)
+ pathname = os.path.join(here, '..', 'virtualenv_embedded', fn_decoded)
+
+ with open(pathname, 'rb') as f:
+ embedded = f.read()
+ new_crc = crc32(embedded)
+ new_data = b64.encode(gzip.encode(embedded)[0])[0]
+
if new_data == data:
- print(' Reference up to date (%s bytes)' % len(c))
- parts.append(match.group(0))
+ print(' File up to date (crc: %s)' % new_crc)
+ parts += [match.group(0)]
continue
- print(' Content changed (%s bytes -> %s bytes)' % (
- zipped_len(data), len(c)))
- new_match = file_template % dict(
- filename=filename,
- varname=varname,
- data=new_data)
- parts.append(new_match)
- parts.append(content[last_pos:])
- new_content = ''.join(parts)
- if new_content != content:
- sys.stdout.write('Content updated; overwriting... ')
- f = open(script, 'wb')
- f.write(new_content)
- f.close()
+ # Else: content has changed
+ crc = crc32(gzip.decode(b64.decode(data)[0])[0])
+ print(' Content changed (crc: %s -> %s)' %
+ (crc, new_crc))
+ new_match = file_template % {
+ b'filename': filename,
+ b'varname': varname,
+ b'data': new_data
+ }
+ parts += [new_match]
+
+ parts += [script_content[last_pos:]]
+ new_content = b''.join(parts)
+
+ if new_content != script_content:
+ print('Content updated; overwriting... ', end='')
+ with open(script_path, 'wb') as f:
+ f.write(new_content)
print('done.')
else:
print('No changes in content')
if match is None:
print('No variables were matched/found')
-def zipped_len(data):
- if not data:
- return 'no data'
- try:
- return len(data.decode('base64').decode('zlib'))
- except:
- return 'unknown'
-
if __name__ == '__main__':
- rebuild()
-
+ rebuild(script)
diff --git a/docs/changes.rst b/docs/changes.rst
index 80c3dc1..95416fd 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -1,13 +1,55 @@
Release History
===============
+14.0.0 (2016-01-19)
+-------------------
+
+* **BACKWARDS INCOMPATIBLE** Drop support for Python 3.2.
+
+* Upgrade setuptools to 19.4
+
+* Upgrade wheel to 0.26.0
+
+* Upgrade pip to 8.0.0
+
+* Upgrade argparse to 1.4.0
+
+* Added support for ``python-config`` script (:pull:`798`)
+
+* Updated activate.fish (:pull:`589`) (:pull:`799`)
+
+* Account for a ``site.pyo`` correctly in some python implementations (:pull:`759`)
+
+* Properly restore an empty PS1 (:issue:`407`)
+
+* Properly remove ``pydoc`` when deactivating
+
+* Remove workaround for very old Mageia / Mandriva linuxes (:pull:`472`)
+
+* Added a space after virtualenv name in the prompt: ``(env) $PS1``
+
+* Make sure not to run a --user install when creating the virtualenv (:pull:`803`)
+
+* Remove virtualenv file's path from directory when executing with a new
+ python. Fixes issue :issue:`779`, :issue:`763` (:pull:`805`)
+
+* Remove use of () in .bat files so ``Program Files (x86)`` works :issue:`35`
+
+* Download new releases of the preinstalled software from PyPI when there are
+ new releases available. This behavior can be disabled using
+ ``--no-download``.
+
+* Make ``--no-setuptools``, ``--no-pip``, and ``--no-wheel`` independent of
+ each other.
+
+
13.1.2 (2015-08-23)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.1.2.
13.1.1 (2015-08-20)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.1.1.
@@ -16,7 +58,7 @@ Release History
* Make the activate script safe to use when bash is running with ``-u``.
13.1.0 (2015-06-30)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.1.0
@@ -24,13 +66,13 @@ Release History
13.0.3 (2015-06-01)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.0.3
13.0.2 (2015-06-01)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.0.2
@@ -38,13 +80,13 @@ Release History
13.0.1 (2015-05-22)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 7.0.1
13.0.0 (2015-05-21)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Automatically install wheel when creating a new virutalenv. This can be
disabled by using the ``--no-wheel`` option.
@@ -58,13 +100,13 @@ Release History
12.1.1 (2015-04-07)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade pip to 6.1.1
12.1.0 (2015-04-07)
-~~~~~~~~~~~~~~~~~~~
+-------------------
* Upgrade setuptools to 15.0
diff --git a/docs/conf.py b/docs/conf.py
index 1d89554..9332aa1 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -24,10 +24,9 @@ sys.path.insert(0, os.path.abspath(os.pardir))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.extlinks']
# Add any paths that contain templates here, relative to this directory.
-## FIXME: disabled for now because I haven't figured out how to use this:
#templates_path = ['_templates']
# The suffix of source filenames.
@@ -74,6 +73,11 @@ unused_docs = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
+extlinks = {
+ 'issue': ('https://github.com/pypa/virtualenv/issues/%s', '#'),
+ 'pull': ('https://github.com/pypa/virtualenv/pull/%s', 'PR #'),
+}
+
# Options for HTML output
# -----------------------
diff --git a/docs/index.rst b/docs/index.rst
index 04f7191..e745a87 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -77,8 +77,8 @@ Other Documentation and Links
He also wrote `an example of using virtualenv to try IPython`__.
.. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrapper/
- .. __: http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html
- .. __: http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html
+ .. __: https://doughellmann.com/blog/2008/05/01/virtualenvwrapper/
+ .. __: https://doughellmann.com/blog/2008/02/01/ipython-and-virtualenv/
* `Pew`_ is another wrapper for virtualenv that makes use of a different
activation technique.
diff --git a/docs/reference.rst b/docs/reference.rst
index e9b577e..9249473 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -69,8 +69,7 @@ Options
.. option:: --no-setuptools
- Do not install setuptools (or pip) in the new
- virtualenv.
+ Do not install setuptools in the new virtualenv.
.. option:: --no-pip
@@ -90,11 +89,13 @@ Options
Provides an alternative prompt prefix for this
environment.
-.. option:: --never-download
+.. option:: --download
- DEPRECATED. Retained only for backward compatibility.
- This option has no effect. Virtualenv never downloads
- pip or setuptools.
+ Download preinstalled packages from PyPI.
+
+.. option:: --no-download
+
+ Do not download preinstalled packages from PyPI.
.. option:: --no-site-packages
diff --git a/docs/userguide.rst b/docs/userguide.rst
index 70d4af8..d9ff5aa 100644
--- a/docs/userguide.rst
+++ b/docs/userguide.rst
@@ -125,6 +125,15 @@ below.
.. _`execution policies`: http://technet.microsoft.com/en-us/library/dd347641.aspx
+Removing an Environment
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Removing a virtual environment is simply done by deactivating it and deleting the
+environment folder with all its contents::
+
+ (ENV)$ deactivate
+ $ rm -r /path/to/ENV
+
The :option:`--system-site-packages` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -245,5 +254,3 @@ As well as the extra directories, the search order includes:
#. The directory where virtualenv.py is located.
#. The current directory.
-If no satisfactory local distributions are found, virtualenv will
-fail. Virtualenv will never download packages.
diff --git a/setup.py b/setup.py
index ce35314..fc71f5a 100644
--- a/setup.py
+++ b/setup.py
@@ -15,18 +15,17 @@ try:
def initialize_options(self):
TestCommand.initialize_options(self)
- self.pytest_args = None
+ self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
- self.test_args = []
- self.test_suite = True
+ #self.test_args = []
+ #self.test_suite = True
def run_tests(self):
# import here, because outside the eggs aren't loaded
import pytest
- errno = pytest.main(self.pytest_args)
- sys.exit(errno)
+ sys.exit(pytest.main(self.pytest_args))
setup_params = {
'entry_points': {
@@ -61,7 +60,24 @@ def read_file(*paths):
long_description = read_file('docs', 'index.rst')
long_description = long_description.strip().split('split here', 1)[0]
# Add release history
-long_description += "\n\n" + read_file('docs', 'changes.rst')
+changes = read_file('docs', 'changes.rst')
+# Only report last two releases for brevity
+releases_found = 0
+change_lines = []
+for line in changes.splitlines():
+ change_lines.append(line)
+ if line.startswith('--------------'):
+ releases_found += 1
+ if releases_found > 2:
+ break
+
+changes = '\n'.join(change_lines[:-2]) + '\n'
+changes += '`Full Changelog <https://virtualenv.pypa.io/en/latest/changes.html>`_.'
+# Replace issue/pull directives
+changes = re.sub(r':pull:`(\d+)`', r'PR #\1', changes)
+changes = re.sub(r':issue:`(\d+)`', r'#\1', changes)
+
+long_description += '\n\n' + changes
def get_version():
@@ -97,6 +113,8 @@ setup(
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
],
keywords='setuptools deployment installation distutils',
author='Ian Bicking',
diff --git a/tests/test_activate.sh b/tests/test_activate.sh
index 5f51720..e277273 100755
--- a/tests/test_activate.sh
+++ b/tests/test_activate.sh
@@ -10,8 +10,8 @@ rm -rf ${TESTENV}
echo "$0: Creating virtualenv ${TESTENV}..." 1>&2
-${VIRTUALENV} ${TESTENV} | tee ${ROOT}/tests/test_activate_actual.output
-if ! diff ${ROOT}/tests/test_activate_expected.output ${ROOT}/tests/test_activate_actual.output; then
+${VIRTUALENV} ${TESTENV} | tee ${ROOT}/tests/test_activate_output.actual
+if ! diff ${ROOT}/tests/test_activate_output.expected ${ROOT}/tests/test_activate_output.actual; then
echo "$0: Failed to get expected output from ${VIRTUALENV}!" 1>&2
exit 1
fi
diff --git a/tests/test_activate_expected.output b/tests/test_activate_output.expected
index 35bf7f7..d49469f 100644
--- a/tests/test_activate_expected.output
+++ b/tests/test_activate_output.expected
@@ -1,2 +1,2 @@
New python executable in /tmp/test_virtualenv_activate.venv/bin/python
-Installing setuptools, pip...done.
+Installing setuptools, pip, wheel...done.
diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py
index ca274a0..756cde9 100644
--- a/tests/test_virtualenv.py
+++ b/tests/test_virtualenv.py
@@ -20,26 +20,24 @@ def test_resolve_interpreter_with_absolute_path(mock_exists):
"""Should return absolute path if given and exists"""
mock_exists.return_value = True
virtualenv.is_executable = Mock(return_value=True)
+ test_abs_path = os.path.abspath("/usr/bin/python53")
- exe = virtualenv.resolve_interpreter("/usr/bin/python42")
+ exe = virtualenv.resolve_interpreter(test_abs_path)
- assert exe == "/usr/bin/python42", "Absolute path should return as is"
- mock_exists.assert_called_with("/usr/bin/python42")
- virtualenv.is_executable.assert_called_with("/usr/bin/python42")
+ assert exe == test_abs_path, "Absolute path should return as is"
+ mock_exists.assert_called_with(test_abs_path)
+ virtualenv.is_executable.assert_called_with(test_abs_path)
@patch('os.path.exists')
def test_resolve_interpreter_with_nonexistent_interpreter(mock_exists):
- """Should exit when with absolute path if not exists"""
+ """Should SystemExit with an nonexistent python interpreter path"""
mock_exists.return_value = False
- try:
- virtualenv.resolve_interpreter("/usr/bin/python42")
- assert False, "Should raise exception"
- except SystemExit:
- pass
+ with pytest.raises(SystemExit):
+ virtualenv.resolve_interpreter("/usr/bin/python53")
- mock_exists.assert_called_with("/usr/bin/python42")
+ mock_exists.assert_called_with("/usr/bin/python53")
@patch('os.path.exists')
@@ -47,15 +45,13 @@ def test_resolve_interpreter_with_invalid_interpreter(mock_exists):
"""Should exit when with absolute path if not exists"""
mock_exists.return_value = True
virtualenv.is_executable = Mock(return_value=False)
+ invalid = os.path.abspath("/usr/bin/pyt_hon53")
- try:
- virtualenv.resolve_interpreter("/usr/bin/python42")
- assert False, "Should raise exception"
- except SystemExit:
- pass
+ with pytest.raises(SystemExit):
+ virtualenv.resolve_interpreter(invalid)
- mock_exists.assert_called_with("/usr/bin/python42")
- virtualenv.is_executable.assert_called_with("/usr/bin/python42")
+ mock_exists.assert_called_with(invalid)
+ virtualenv.is_executable.assert_called_with(invalid)
def test_activate_after_future_statements():
diff --git a/tests/tox.ini b/tests/tox.ini
deleted file mode 100644
index da59e02..0000000
--- a/tests/tox.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-# Tox (http://codespeak.net/~hpk/tox/) is a tool for running tests
-# in multiple virtualenvs. This configuration file will run the
-# test suite on all supported python versions. To use it, "pip install tox"
-# and then run "tox" from this directory.
-
-[tox]
-envlist = py25, py26, py27, py31, py32, pypy, jython
-setupdir = ..
-
-[testenv]
-commands = python setup.py test
-changedir = ..
diff --git a/tox.ini b/tox.ini
index d2661ea..10a738c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
- py26,py27,py32,py33,py34,pypy,pypy3,docs
+ py26, py27, py32, py33, py34, py35, pypy, pypy3, docs
[testenv]
deps =
@@ -11,7 +11,9 @@ commands =
python virtualenv.py {envtmpdir}/test-venv-01
[testenv:docs]
-deps = sphinx
-basepython = python2.7
+deps =
+ sphinx
+ readme
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
+ python setup.py check -m -r -s
diff --git a/virtualenv.py b/virtualenv.py
index da25205..4f5b119 100755
--- a/virtualenv.py
+++ b/virtualenv.py
@@ -1,27 +1,40 @@
#!/usr/bin/env python
-"""Create a "virtual" Python installation
-"""
+"""Create a "virtual" Python installation"""
-__version__ = "13.1.2"
-virtualenv_version = __version__ # legacy
+import os
+import sys
+
+# If we are running in a new interpreter to create a virtualenv,
+# we do NOT want paths from our existing location interfering with anything,
+# So we remove this file's directory from sys.path - most likely to be
+# the previous interpreter's site-packages. Solves #705, #763, #779
+if os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
+ for path in sys.path[:]:
+ if os.path.realpath(os.path.dirname(__file__)) == os.path.realpath(path):
+ sys.path.remove(path)
import base64
-import sys
-import os
import codecs
import optparse
import re
import shutil
import logging
-import tempfile
import zlib
import errno
import glob
import distutils.sysconfig
-from distutils.util import strtobool
import struct
import subprocess
-import tarfile
+from distutils.util import strtobool
+from os.path import join
+
+try:
+ import ConfigParser
+except ImportError:
+ import configparser as ConfigParser
+
+__version__ = "14.0.0"
+virtualenv_version = __version__ # legacy
if sys.version_info < (2, 6):
print('ERROR: %s' % sys.exc_info()[1])
@@ -33,12 +46,6 @@ try:
except NameError:
basestring = str
-try:
- import ConfigParser
-except ImportError:
- import configparser as ConfigParser
-
-join = os.path.join
py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
is_jython = sys.platform.startswith('java')
@@ -76,7 +83,7 @@ else:
def get_installed_pythons():
try:
python_core = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE,
- "Software\\Python\\PythonCore")
+ "Software\\Python\\PythonCore")
except WindowsError:
# No registered Python installations
return {}
@@ -123,168 +130,21 @@ if majver == 2:
elif majver == 3:
# Some extra modules are needed for Python 3, but different ones
# for different versions.
- REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
- '_weakrefset', 'copyreg', 'tempfile', 'random',
- '__future__', 'collections', 'keyword', 'tarfile',
- 'shutil', 'struct', 'copy', 'tokenize', 'token',
- 'functools', 'heapq', 'bisect', 'weakref',
- 'reprlib'])
+ REQUIRED_MODULES.extend([
+ '_abcoll', 'warnings', 'linecache', 'abc', 'io', '_weakrefset',
+ 'copyreg', 'tempfile', 'random', '__future__', 'collections',
+ 'keyword', 'tarfile', 'shutil', 'struct', 'copy', 'tokenize',
+ 'token', 'functools', 'heapq', 'bisect', 'weakref', 'reprlib'
+ ])
if minver >= 2:
REQUIRED_FILES[-1] = 'config-%s' % majver
if minver >= 3:
import sysconfig
platdir = sysconfig.get_config_var('PLATDIR')
REQUIRED_FILES.append(platdir)
- # The whole list of 3.3 modules is reproduced below - the current
- # uncommented ones are required for 3.3 as of now, but more may be
- # added as 3.3 development continues.
REQUIRED_MODULES.extend([
- #"aifc",
- #"antigravity",
- #"argparse",
- #"ast",
- #"asynchat",
- #"asyncore",
- "base64",
- #"bdb",
- #"binhex",
- #"bisect",
- #"calendar",
- #"cgi",
- #"cgitb",
- #"chunk",
- #"cmd",
- #"codeop",
- #"code",
- #"colorsys",
- #"_compat_pickle",
- #"compileall",
- #"concurrent",
- #"configparser",
- #"contextlib",
- #"cProfile",
- #"crypt",
- #"csv",
- #"ctypes",
- #"curses",
- #"datetime",
- #"dbm",
- #"decimal",
- #"difflib",
- #"dis",
- #"doctest",
- #"dummy_threading",
- "_dummy_thread",
- #"email",
- #"filecmp",
- #"fileinput",
- #"formatter",
- #"fractions",
- #"ftplib",
- #"functools",
- #"getopt",
- #"getpass",
- #"gettext",
- #"glob",
- #"gzip",
- "hashlib",
- #"heapq",
- "hmac",
- #"html",
- #"http",
- #"idlelib",
- #"imaplib",
- #"imghdr",
- "imp",
- "importlib",
- #"inspect",
- #"json",
- #"lib2to3",
- #"logging",
- #"macpath",
- #"macurl2path",
- #"mailbox",
- #"mailcap",
- #"_markupbase",
- #"mimetypes",
- #"modulefinder",
- #"multiprocessing",
- #"netrc",
- #"nntplib",
- #"nturl2path",
- #"numbers",
- #"opcode",
- #"optparse",
- #"os2emxpath",
- #"pdb",
- #"pickle",
- #"pickletools",
- #"pipes",
- #"pkgutil",
- #"platform",
- #"plat-linux2",
- #"plistlib",
- #"poplib",
- #"pprint",
- #"profile",
- #"pstats",
- #"pty",
- #"pyclbr",
- #"py_compile",
- #"pydoc_data",
- #"pydoc",
- #"_pyio",
- #"queue",
- #"quopri",
- #"reprlib",
- "rlcompleter",
- #"runpy",
- #"sched",
- #"shelve",
- #"shlex",
- #"smtpd",
- #"smtplib",
- #"sndhdr",
- #"socket",
- #"socketserver",
- #"sqlite3",
- #"ssl",
- #"stringprep",
- #"string",
- #"_strptime",
- #"subprocess",
- #"sunau",
- #"symbol",
- #"symtable",
- #"sysconfig",
- #"tabnanny",
- #"telnetlib",
- #"test",
- #"textwrap",
- #"this",
- #"_threading_local",
- #"threading",
- #"timeit",
- #"tkinter",
- #"tokenize",
- #"token",
- #"traceback",
- #"trace",
- #"tty",
- #"turtledemo",
- #"turtle",
- #"unittest",
- #"urllib",
- #"uuid",
- #"uu",
- #"wave",
- #"weakref",
- #"webbrowser",
- #"wsgiref",
- #"xdrlib",
- #"xml",
- #"xmlrpc",
- #"zipfile",
+ 'base64', '_dummy_thread', 'hashlib', 'hmac',
+ 'imp', 'importlib', 'rlcompleter'
])
if minver >= 4:
REQUIRED_MODULES.extend([
@@ -298,6 +158,7 @@ if is_pypy:
# during the bootstrap
REQUIRED_MODULES.extend(['traceback', 'linecache'])
+
class Logger(object):
"""
@@ -322,16 +183,22 @@ class Logger(object):
def debug(self, msg, *args, **kw):
self.log(self.DEBUG, msg, *args, **kw)
+
def info(self, msg, *args, **kw):
self.log(self.INFO, msg, *args, **kw)
+
def notify(self, msg, *args, **kw):
self.log(self.NOTIFY, msg, *args, **kw)
+
def warn(self, msg, *args, **kw):
self.log(self.WARN, msg, *args, **kw)
+
def error(self, msg, *args, **kw):
self.log(self.ERROR, msg, *args, **kw)
+
def fatal(self, msg, *args, **kw):
self.log(self.FATAL, msg, *args, **kw)
+
def log(self, level, msg, *args, **kw):
if args:
if kw:
@@ -714,7 +581,7 @@ def main():
'--no-setuptools',
dest='no_setuptools',
action='store_true',
- help='Do not install setuptools (or pip) in the new virtualenv.')
+ help='Do not install setuptools in the new virtualenv.')
parser.add_option(
'--no-pip',
@@ -739,12 +606,19 @@ def main():
"This option can be used multiple times.")
parser.add_option(
- '--never-download',
- dest="never_download",
+ "--download",
+ dest="download",
action="store_true",
- default=True,
- help="DEPRECATED. Retained only for backward compatibility. This option has no effect. "
- "Virtualenv never downloads pip or setuptools.")
+ help="Download preinstalled packages from PyPI.",
+ )
+
+ parser.add_option(
+ "--no-download",
+ '--never-download',
+ dest="download",
+ action="store_false",
+ help="Do not download preinstalled packages from PyPI.",
+ )
parser.add_option(
'--prompt',
@@ -815,17 +689,13 @@ def main():
make_environment_relocatable(home_dir)
return
- if not options.never_download:
- logger.warn('The --never-download option is for backward compatibility only.')
- logger.warn('Setting it to false is no longer supported, and will be ignored.')
-
create_environment(home_dir,
site_packages=options.system_site_packages,
clear=options.clear,
unzip_setuptools=options.unzip_setuptools,
prompt=options.prompt,
search_dirs=options.search_dirs,
- never_download=True,
+ download=options.download,
no_setuptools=options.no_setuptools,
no_pip=options.no_pip,
no_wheel=options.no_wheel,
@@ -944,13 +814,27 @@ def find_wheels(projects, search_dirs):
return wheels
-def install_wheel(project_names, py_executable, search_dirs=None):
+def install_wheel(project_names, py_executable, search_dirs=None,
+ download=False):
if search_dirs is None:
search_dirs = file_search_dirs()
wheels = find_wheels(['setuptools', 'pip'], search_dirs)
pythonpath = os.pathsep.join(wheels)
- findlinks = ' '.join(search_dirs)
+
+ # PIP_FIND_LINKS uses space as the path separator and thus cannot have paths
+ # with spaces in them. Convert any of those to local file:// URL form.
+ try:
+ from urlparse import urljoin
+ from urllib import pathname2url
+ except ImportError:
+ from urllib.parse import urljoin
+ from urllib.request import pathname2url
+ def space_path2url(p):
+ if ' ' not in p:
+ return p
+ return urljoin('file:', pathname2url(os.path.abspath(p)))
+ findlinks = ' '.join(space_path2url(d) for d in search_dirs)
cmd = [
py_executable, '-c',
@@ -958,24 +842,29 @@ def install_wheel(project_names, py_executable, search_dirs=None):
] + project_names
logger.start_progress('Installing %s...' % (', '.join(project_names)))
logger.indent += 2
+
+ env = {
+ "PYTHONPATH": pythonpath,
+ "JYTHONPATH": pythonpath, # for Jython < 3.x
+ "PIP_FIND_LINKS": findlinks,
+ "PIP_USE_WHEEL": "1",
+ "PIP_ONLY_BINARY": ":all:",
+ "PIP_PRE": "1",
+ "PIP_USER": "0",
+ }
+
+ if not download:
+ env["PIP_NO_INDEX"] = "1"
+
try:
- call_subprocess(cmd, show_stdout=False,
- extra_env = {
- 'PYTHONPATH': pythonpath,
- 'JYTHONPATH': pythonpath, # for Jython < 3.x
- 'PIP_FIND_LINKS': findlinks,
- 'PIP_USE_WHEEL': '1',
- 'PIP_PRE': '1',
- 'PIP_NO_INDEX': '1'
- }
- )
+ call_subprocess(cmd, show_stdout=False, extra_env=env)
finally:
logger.indent -= 2
logger.end_progress()
def create_environment(home_dir, site_packages=False, clear=False,
unzip_setuptools=False,
- prompt=None, search_dirs=None, never_download=False,
+ prompt=None, search_dirs=None, download=False,
no_setuptools=False, no_pip=False, no_wheel=False,
symlink=True):
"""
@@ -995,22 +884,36 @@ def create_environment(home_dir, site_packages=False, clear=False,
install_distutils(home_dir)
+ to_install = []
+
if not no_setuptools:
- to_install = ['setuptools']
- if not no_pip:
- to_install.append('pip')
- if not no_wheel:
- to_install.append('wheel')
- install_wheel(to_install, py_executable, search_dirs)
+ to_install.append('setuptools')
+
+ if not no_pip:
+ to_install.append('pip')
+
+ if not no_wheel:
+ to_install.append('wheel')
+
+ if to_install:
+ install_wheel(
+ to_install,
+ py_executable,
+ search_dirs,
+ download=download,
+ )
install_activate(home_dir, bin_dir, prompt)
+ install_python_config(home_dir, bin_dir, prompt)
+
def is_executable_file(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
def path_locations(home_dir):
"""Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
+ home_dir = os.path.abspath(home_dir)
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.python.org/issue3386
if is_win:
@@ -1047,17 +950,7 @@ def path_locations(home_dir):
bin_dir = join(home_dir, 'bin')
elif not is_win:
lib_dir = join(home_dir, 'lib', py_version)
- multiarch_exec = '/usr/bin/multiarch-platform'
- if is_executable_file(multiarch_exec):
- # In Mageia (2) and Mandriva distros the include dir must be like:
- # virtualenv/include/multiarch-x86_64-linux/python2.7
- # instead of being virtualenv/include/python2.7
- p = subprocess.Popen(multiarch_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- stdout, stderr = p.communicate()
- # stdout.strip is needed to remove newline character
- inc_dir = join(home_dir, 'include', stdout.strip(), py_version + abiflags)
- else:
- inc_dir = join(home_dir, 'include', py_version + abiflags)
+ inc_dir = join(home_dir, 'include', py_version + abiflags)
bin_dir = join(home_dir, 'bin')
return home_dir, lib_dir, inc_dir, bin_dir
@@ -1096,45 +989,34 @@ def change_prefix(filename, dst_prefix):
def copy_required_modules(dst_prefix, symlink):
import imp
- # If we are running under -p, we need to remove the current
- # directory from sys.path temporarily here, so that we
- # definitely get the modules from the site directory of
- # the interpreter we are running under, not the one
- # virtualenv.py is installed under (which might lead to py2/py3
- # incompatibility issues)
- _prev_sys_path = sys.path
- if os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
- sys.path = sys.path[1:]
- try:
- for modname in REQUIRED_MODULES:
- if modname in sys.builtin_module_names:
- logger.info("Ignoring built-in bootstrap module: %s" % modname)
- continue
- try:
- f, filename, _ = imp.find_module(modname)
- except ImportError:
- logger.info("Cannot import bootstrap module: %s" % modname)
+
+ for modname in REQUIRED_MODULES:
+ if modname in sys.builtin_module_names:
+ logger.info("Ignoring built-in bootstrap module: %s" % modname)
+ continue
+ try:
+ f, filename, _ = imp.find_module(modname)
+ except ImportError:
+ logger.info("Cannot import bootstrap module: %s" % modname)
+ else:
+ if f is not None:
+ f.close()
+ # special-case custom readline.so on OS X, but not for pypy:
+ if modname == 'readline' and sys.platform == 'darwin' and not (
+ is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))):
+ dst_filename = join(dst_prefix, 'lib', 'python%s' % sys.version[:3], 'readline.so')
+ elif modname == 'readline' and sys.platform == 'win32':
+ # special-case for Windows, where readline is not a
+ # standard module, though it may have been installed in
+ # site-packages by a third-party package
+ pass
else:
- if f is not None:
- f.close()
- # special-case custom readline.so on OS X, but not for pypy:
- if modname == 'readline' and sys.platform == 'darwin' and not (
- is_pypy or filename.endswith(join('lib-dynload', 'readline.so'))):
- dst_filename = join(dst_prefix, 'lib', 'python%s' % sys.version[:3], 'readline.so')
- elif modname == 'readline' and sys.platform == 'win32':
- # special-case for Windows, where readline is not a
- # standard module, though it may have been installed in
- # site-packages by a third-party package
- pass
- else:
- dst_filename = change_prefix(filename, dst_prefix)
- copyfile(filename, dst_filename, symlink)
- if filename.endswith('.pyc'):
- pyfile = filename[:-1]
- if os.path.exists(pyfile):
- copyfile(pyfile, dst_filename[:-1], symlink)
- finally:
- sys.path = _prev_sys_path
+ dst_filename = change_prefix(filename, dst_prefix)
+ copyfile(filename, dst_filename, symlink)
+ if filename.endswith('.pyc'):
+ pyfile = filename[:-1]
+ if os.path.exists(pyfile):
+ copyfile(pyfile, dst_filename[:-1], symlink)
def subst_path(prefix_path, prefix, home_dir):
@@ -1195,7 +1077,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
mkdir(join(lib_dir, 'site-packages'))
import site
site_filename = site.__file__
- if site_filename.endswith('.pyc'):
+ if site_filename.endswith('.pyc') or site_filename.endswith('.pyo'):
site_filename = site_filename[:-1]
elif site_filename.endswith('$py.class'):
site_filename = site_filename.replace('$py.class', '.py')
@@ -1490,7 +1372,6 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
def install_activate(home_dir, bin_dir, prompt=None):
- home_dir = os.path.abspath(home_dir)
if is_win or is_jython and os._name == 'nt':
files = {
'activate.bat': ACTIVATE_BAT,
@@ -1518,6 +1399,10 @@ def install_activate(home_dir, bin_dir, prompt=None):
files['activate.csh'] = ACTIVATE_CSH
files['activate_this.py'] = ACTIVATE_THIS
+
+ install_files(home_dir, bin_dir, prompt, files)
+
+def install_files(home_dir, bin_dir, prompt, files):
if hasattr(home_dir, 'decode'):
home_dir = home_dir.decode(sys.getfilesystemencoding())
vname = os.path.basename(home_dir)
@@ -1529,6 +1414,15 @@ def install_activate(home_dir, bin_dir, prompt=None):
content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
writefile(os.path.join(bin_dir, name), content)
+def install_python_config(home_dir, bin_dir, prompt=None):
+ if sys.platform == 'win32' or is_jython and os._name == 'nt':
+ files = {}
+ else:
+ files = {'python-config': PYTHON_CONFIG}
+ install_files(home_dir, bin_dir, prompt, files)
+ for name, content in files.items():
+ make_exe(os.path.join(bin_dir, name))
+
def install_distutils(home_dir):
distutils_path = change_prefix(distutils.__path__[0], home_dir)
mkdir(distutils_path)
@@ -1566,30 +1460,32 @@ def fix_lib64(lib_dir, symlink=True):
instead of lib/pythonX.Y. If this is such a platform we'll just create a
symlink so lib64 points to lib
"""
- if [p for p in distutils.sysconfig.get_config_vars().values()
- if isinstance(p, basestring) and 'lib64' in p]:
- # PyPy's library path scheme is not affected by this.
- # Return early or we will die on the following assert.
- if is_pypy:
- logger.debug('PyPy detected, skipping lib64 symlinking')
- return
-
- logger.debug('This system uses lib64; symlinking lib64 to lib')
-
- assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
- "Unexpected python lib dir: %r" % lib_dir)
- lib_parent = os.path.dirname(lib_dir)
- top_level = os.path.dirname(lib_parent)
- lib_dir = os.path.join(top_level, 'lib')
- lib64_link = os.path.join(top_level, 'lib64')
- assert os.path.basename(lib_parent) == 'lib', (
- "Unexpected parent dir: %r" % lib_parent)
- if os.path.lexists(lib64_link):
- return
- if symlink:
- os.symlink('lib', lib64_link)
- else:
- copyfile('lib', lib64_link)
+ # PyPy's library path scheme is not affected by this.
+ # Return early or we will die on the following assert.
+ if is_pypy:
+ logger.debug('PyPy detected, skipping lib64 symlinking')
+ return
+ # Check we have a lib64 library path
+ if not [p for p in distutils.sysconfig.get_config_vars().values()
+ if isinstance(p, basestring) and 'lib64' in p]:
+ return
+
+ logger.debug('This system uses lib64; symlinking lib64 to lib')
+
+ assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
+ "Unexpected python lib dir: %r" % lib_dir)
+ lib_parent = os.path.dirname(lib_dir)
+ top_level = os.path.dirname(lib_parent)
+ lib_dir = os.path.join(top_level, 'lib')
+ lib64_link = os.path.join(top_level, 'lib64')
+ assert os.path.basename(lib_parent) == 'lib', (
+ "Unexpected parent dir: %r" % lib_parent)
+ if os.path.lexists(lib64_link):
+ return
+ if symlink:
+ os.symlink('lib', lib64_link)
+ else:
+ copyfile('lib', lib64_link)
def resolve_interpreter(exe):
"""
@@ -1604,8 +1500,8 @@ def resolve_interpreter(exe):
if os.path.abspath(exe) != exe:
paths = os.environ.get('PATH', '').split(os.pathsep)
for path in paths:
- if os.path.exists(os.path.join(path, exe)):
- exe = os.path.join(path, exe)
+ if os.path.exists(join(path, exe)):
+ exe = join(path, exe)
break
if not os.path.exists(exe):
logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
@@ -2014,71 +1910,70 @@ AVijEPwfucjncQ==
##file activate.sh
ACTIVATE_SH = convert("""
-eJytVVFv2jAQfs+vuIY+lGo0Yo+tmEQ1JJBaqBrWaWurYJKDWAo2ShxSWvW/7+yEEAhl0tY8EOI7
-332++75zA8YhT2DGI4RFmiiYIqQJBpBxFYKdyDT2EaZcOMxXfMUU2nA+i+UCpiwJz60GrGUKPhNC
-KohTAVxBwGP0VbS2rAA3u+CsCW8W0JOKBBUs14H0LbPQgBj1kowCQLHisRQLFApWLOZsGmFivPgM
-HqElwD5980Y3372Hwf34R/fGu+uO+613G57hClSIwjjrRxs69mnN2S498GUpY2Ucy7UcXW2Tsc/4
-cSS/xv3RsD+67R3GU5prqEpLHVtpOopw14twFoU1vU1CmVJpA1TUFdM2YCKA1yT8AlnI/RBCtkJg
-9CKTLxcLbVYhU4YRRSjihc+iiJihJMwJATWa/s1krD+WjKhTbE0uAH4Se2SqCrP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xAVjM
+osm1Zz526e+shQ4hKRVci69nPC3Kw4NQEmkQ65E7OodxorSvxjvpBjQHDmWFIQ1mlmzlS5vedseT
+/mgIEsMJ7Lxz2bLAF9M5xeLEhdbHxpWOw0GdkJApMVBRF1y+a0z3c9WZPAXGFcFrJgCIB+024uad
+0CrzmEoRa3Ub4swNIHPGf7QDV+2uj2OiFWsChgCwjKqN6rp5izpbH6Wc1O1TclQTP/XVwi6anTr1
+1sbubjZLI1+VptPSdCfwnFBrB1jvebrTA9uUhU2/9gad7xPqeFkaQcnnLbCViZK8d7R1kxzFrIJV
+8EaLYmKYpvGVkig+3C5HCXbM1jGCGekiM2pRCVPyRyXYdPf6kcbWEQ36F5V4Gq9N7icNNw+JHwRE
+LTgxRXACpvnQv/PuT0xCCAywY/K4hE6Now2qDwaSE5FB+1agsoUveYDepS83qFcF1NufvULD3fTl
+g6Hgf7WBt6lzMeiyyWVn3P1WVbwaczHmTzE9A5SyItTVgFYyvs/L/fXlaNgbw8v3azT+0eikVlWD
+/vBHbzQumP23uBCjsYdrL9OWARwxs/nuLOzeXbPJTa/Xv6sUmQir5pC1YRLz3eA+CD8Z0XpcW8v9
+MZWF36ryyXXf3yBIz6nzqz8Muyz0m5Qj7OexfYo/Ph3LqvkHUg7AuA==
+""")
+
MH_MAGIC = 0xfeedface
MH_CIGAM = 0xcefaedfe
MH_MAGIC_64 = 0xfeedfacf
@@ -2362,6 +2276,6 @@ def mach_o_change(path, what, value):
if __name__ == '__main__':
main()
-## TODO:
-## Copy python.exe.manifest
-## Monkeypatch distutils.sysconfig
+# TODO:
+# Copy python.exe.manifest
+# Monkeypatch distutils.sysconfig
diff --git a/virtualenv_embedded/activate.bat b/virtualenv_embedded/activate.bat
index 4c2003e..ed42021 100644
--- a/virtualenv_embedded/activate.bat
+++ b/virtualenv_embedded/activate.bat
@@ -1,26 +1,30 @@
-@echo off
-set "VIRTUAL_ENV=__VIRTUAL_ENV__"
-
-if defined _OLD_VIRTUAL_PROMPT (
- set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
-) else (
- if not defined PROMPT (
- set "PROMPT=$P$G"
- )
- set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
-)
-set "PROMPT=__VIRTUAL_WINPROMPT__ %PROMPT%"
-
-if not defined _OLD_VIRTUAL_PYTHONHOME (
- set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
-)
-set PYTHONHOME=
-
-if defined _OLD_VIRTUAL_PATH (
- set "PATH=%_OLD_VIRTUAL_PATH%"
-) else (
- set "_OLD_VIRTUAL_PATH=%PATH%"
-)
-set "PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%"
-
-:END
+@echo off
+set "VIRTUAL_ENV=__VIRTUAL_ENV__"
+
+if defined _OLD_VIRTUAL_PROMPT (
+ set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
+) else (
+ if not defined PROMPT (
+ set "PROMPT=$P$G"
+ )
+ set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
+)
+set "PROMPT=__VIRTUAL_WINPROMPT__ %PROMPT%"
+
+REM Don't use () to avoid problems with them in %PATH%
+if defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME
+ set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
+:ENDIFVHOME
+
+set PYTHONHOME=
+
+REM if defined _OLD_VIRTUAL_PATH (
+if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH1
+ set "PATH=%_OLD_VIRTUAL_PATH%"
+:ENDIFVPATH1
+REM ) else (
+if defined _OLD_VIRTUAL_PATH goto ENDIFVPATH2
+ set "_OLD_VIRTUAL_PATH=%PATH%"
+:ENDIFVPATH2
+
+set "PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%"
diff --git a/virtualenv_embedded/activate.csh b/virtualenv_embedded/activate.csh
index 9db7744..864865b 100644
--- a/virtualenv_embedded/activate.csh
+++ b/virtualenv_embedded/activate.csh
@@ -17,13 +17,7 @@ setenv PATH "$VIRTUAL_ENV/__BIN_NAME__:$PATH"
if ("__VIRTUAL_PROMPT__" != "") then
set env_name = "__VIRTUAL_PROMPT__"
else
- if (`basename "$VIRTUAL_ENV"` == "__") then
- # special case for Aspen magic directories
- # see http://www.zetadev.com/software/aspen/
- set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
- else
- set env_name = `basename "$VIRTUAL_ENV"`
- endif
+ set env_name = `basename "$VIRTUAL_ENV"`
endif
# Could be in a non-interactive environment,
diff --git a/virtualenv_embedded/activate.fish b/virtualenv_embedded/activate.fish
index eaa241d..f3d1797 100644
--- a/virtualenv_embedded/activate.fish
+++ b/virtualenv_embedded/activate.fish
@@ -1,35 +1,39 @@
-# This file must be used with "source bin/activate.fish" *from fish* (http://fishshell.com)
-# you cannot run it directly
+# This file must be used using `. bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
+# Do not run it directly.
-function deactivate -d "Exit virtualenv and return to normal shell environment"
+function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
# reset old environment variables
- if test -n "$_OLD_VIRTUAL_PATH"
+ if test -n "$_OLD_VIRTUAL_PATH"
set -gx PATH $_OLD_VIRTUAL_PATH
set -e _OLD_VIRTUAL_PATH
end
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
set -e _OLD_VIRTUAL_PYTHONHOME
end
-
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
- # set an empty local fish_function_path, so fish_prompt doesn't automatically reload
+ # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
set -l fish_function_path
- # erase the virtualenv's fish_prompt function, and restore the original
+
+ # Erase virtualenv's `fish_prompt` and restore the original.
functions -e fish_prompt
functions -c _old_fish_prompt fish_prompt
functions -e _old_fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
end
-
+
set -e VIRTUAL_ENV
- if test "$argv[1]" != "nondestructive"
- # Self destruct!
+
+ if test "$argv[1]" != 'nondestructive'
+ # Self-destruct!
+ functions -e pydoc
functions -e deactivate
end
end
-# unset irrelevant variables
+# Unset irrelevant variables.
deactivate nondestructive
set -gx VIRTUAL_ENV "__VIRTUAL_ENV__"
@@ -37,38 +41,36 @@ set -gx VIRTUAL_ENV "__VIRTUAL_ENV__"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/__BIN_NAME__" $PATH
-# unset PYTHONHOME if set
+# Unset `$PYTHONHOME` if set.
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
+function pydoc
+ python -m pydoc $argv
+end
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
- # fish uses a function instead of an env var to generate the prompt.
-
- # copy the current fish_prompt function as the function _old_fish_prompt
+ # Copy the current `fish_prompt` function as `_old_fish_prompt`.
functions -c fish_prompt _old_fish_prompt
-
- # with the original prompt function copied, we can override with our own.
+
function fish_prompt
- # Prompt override?
+ # Save the current $status, for fish_prompts that display it.
+ set -l old_status $status
+
+ # Prompt override provided?
+ # If not, just prepend the environment name.
if test -n "__VIRTUAL_PROMPT__"
- printf "%s%s" "__VIRTUAL_PROMPT__" (set_color normal)
- _old_fish_prompt
- return
- end
- # ...Otherwise, prepend env
- set -l _checkbase (basename "$VIRTUAL_ENV")
- if test $_checkbase = "__"
- # special case for Aspen magic directories
- # see http://www.zetadev.com/software/aspen/
- printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
- _old_fish_prompt
+ printf '%s%s' "__VIRTUAL_PROMPT__" (set_color normal)
else
- printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
- _old_fish_prompt
+ printf '%s(%s%s%s) ' (set_color normal) (set_color -o white) (basename "$VIRTUAL_ENV") (set_color normal)
end
- end
-
+
+ # Restore the original $status
+ echo "exit $old_status" | source
+ _old_fish_prompt
+ end
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
diff --git a/virtualenv_embedded/activate.sh b/virtualenv_embedded/activate.sh
index d8bb469..ecf30a7 100644
--- a/virtualenv_embedded/activate.sh
+++ b/virtualenv_embedded/activate.sh
@@ -2,15 +2,16 @@
# you cannot run it directly
deactivate () {
- unset pydoc
+ unset -f pydoc
# reset old environment variables
- if [ -n "${_OLD_VIRTUAL_PATH-}" ] ; then
+ # ! [ -z ${VAR+_} ] returns true if VAR is declared at all
+ if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
- if [ -n "${_OLD_VIRTUAL_PYTHONHOME-}" ] ; then
+ if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
@@ -19,11 +20,11 @@ deactivate () {
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
- if [ -n "${BASH-}" -o -n "${ZSH_VERSION-}" ] ; then
+ if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
hash -r 2>/dev/null
fi
- if [ -n "${_OLD_VIRTUAL_PS1-}" ] ; then
+ if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
PS1="$_OLD_VIRTUAL_PS1"
export PS1
unset _OLD_VIRTUAL_PS1
@@ -47,9 +48,7 @@ PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
export PATH
# unset PYTHONHOME if set
-# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
-# could use `if (set -u; : $PYTHONHOME) ;` in bash
-if [ -n "${PYTHONHOME-}" ] ; then
+if ! [ -z "${PYTHONHOME+_}" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
unset PYTHONHOME
fi
@@ -59,22 +58,21 @@ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
if [ "x__VIRTUAL_PROMPT__" != x ] ; then
PS1="__VIRTUAL_PROMPT__$PS1"
else
- if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
- # special case for Aspen magic directories
- # see http://www.zetadev.com/software/aspen/
- PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
- else
- PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
- fi
+ PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
fi
export PS1
fi
-alias pydoc="python -m pydoc"
+# Make sure to unalias pydoc if it's already there
+alias pydoc 2>/dev/null >/dev/null && unalias pydoc
+
+pydoc () {
+ python -m pydoc "$@"
+}
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
-if [ -n "${BASH-}" -o -n "${ZSH_VERSION-}" ] ; then
+if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
hash -r 2>/dev/null
fi
diff --git a/virtualenv_embedded/deactivate.bat b/virtualenv_embedded/deactivate.bat
index fd4db26..74d3671 100644
--- a/virtualenv_embedded/deactivate.bat
+++ b/virtualenv_embedded/deactivate.bat
@@ -2,19 +2,18 @@
set VIRTUAL_ENV=
-if defined _OLD_VIRTUAL_PROMPT (
+REM Don't use () to avoid problems with them in %PATH%
+if not defined _OLD_VIRTUAL_PROMPT goto ENDIFVPROMPT
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
- set _OLD_VIRTUAL_PROMPT=
-)
+ set _OLD_VIRTUAL_PROMPT=
+:ENDIFVPROMPT
-if defined _OLD_VIRTUAL_PYTHONHOME (
+if not defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
set _OLD_VIRTUAL_PYTHONHOME=
-)
+:ENDIFVHOME
-if defined _OLD_VIRTUAL_PATH (
+if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH
set "PATH=%_OLD_VIRTUAL_PATH%"
- set _OLD_VIRTUAL_PATH=
-)
-
-:END
+ set _OLD_VIRTUAL_PATH=
+:ENDIFVPATH \ No newline at end of file
diff --git a/virtualenv_embedded/python-config b/virtualenv_embedded/python-config
new file mode 100644
index 0000000..5e7a7c9
--- /dev/null
+++ b/virtualenv_embedded/python-config
@@ -0,0 +1,78 @@
+#!__VIRTUAL_ENV__/__BIN_NAME__/python
+
+import sys
+import getopt
+import sysconfig
+
+valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
+ 'ldflags', 'help']
+
+if sys.version_info >= (3, 2):
+ valid_opts.insert(-1, 'extension-suffix')
+ valid_opts.append('abiflags')
+if sys.version_info >= (3, 3):
+ valid_opts.append('configdir')
+
+
+def exit_with_usage(code=1):
+ sys.stderr.write("Usage: {0} [{1}]\n".format(
+ sys.argv[0], '|'.join('--'+opt for opt in valid_opts)))
+ sys.exit(code)
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
+except getopt.error:
+ exit_with_usage()
+
+if not opts:
+ exit_with_usage()
+
+pyver = sysconfig.get_config_var('VERSION')
+getvar = sysconfig.get_config_var
+
+opt_flags = [flag for (flag, val) in opts]
+
+if '--help' in opt_flags:
+ exit_with_usage(code=0)
+
+for opt in opt_flags:
+ if opt == '--prefix':
+ print(sysconfig.get_config_var('prefix'))
+
+ elif opt == '--exec-prefix':
+ print(sysconfig.get_config_var('exec_prefix'))
+
+ elif opt in ('--includes', '--cflags'):
+ flags = ['-I' + sysconfig.get_path('include'),
+ '-I' + sysconfig.get_path('platinclude')]
+ if opt == '--cflags':
+ flags.extend(getvar('CFLAGS').split())
+ print(' '.join(flags))
+
+ elif opt in ('--libs', '--ldflags'):
+ abiflags = getattr(sys, 'abiflags', '')
+ libs = ['-lpython' + pyver + abiflags]
+ libs += getvar('LIBS').split()
+ libs += getvar('SYSLIBS').split()
+ # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+ # shared library in prefix/lib/.
+ if opt == '--ldflags':
+ if not getvar('Py_ENABLE_SHARED'):
+ libs.insert(0, '-L' + getvar('LIBPL'))
+ if not getvar('PYTHONFRAMEWORK'):
+ libs.extend(getvar('LINKFORSHARED').split())
+ print(' '.join(libs))
+
+ elif opt == '--extension-suffix':
+ ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
+ if ext_suffix is None:
+ ext_suffix = sysconfig.get_config_var('SO')
+ print(ext_suffix)
+
+ elif opt == '--abiflags':
+ if not getattr(sys, 'abiflags', None):
+ exit_with_usage()
+ print(sys.abiflags)
+
+ elif opt == '--configdir':
+ print(sysconfig.get_config_var('LIBPL'))
diff --git a/virtualenv_support/argparse-1.3.0-py2.py3-none-any.whl b/virtualenv_support/argparse-1.3.0-py2.py3-none-any.whl
deleted file mode 100644
index c1f32a2..0000000
--- a/virtualenv_support/argparse-1.3.0-py2.py3-none-any.whl
+++ /dev/null
Binary files differ
diff --git a/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl b/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl
new file mode 100644
index 0000000..dfef51d
--- /dev/null
+++ b/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl
Binary files differ
diff --git a/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl b/virtualenv_support/pip-8.0.0-py2.py3-none-any.whl
index 5e49015..4e685be 100644
--- a/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl
+++ b/virtualenv_support/pip-8.0.0-py2.py3-none-any.whl
Binary files differ
diff --git a/virtualenv_support/setuptools-18.2-py2.py3-none-any.whl b/virtualenv_support/setuptools-19.4-py2.py3-none-any.whl
index f4288d6..b58455f 100644
--- a/virtualenv_support/setuptools-18.2-py2.py3-none-any.whl
+++ b/virtualenv_support/setuptools-19.4-py2.py3-none-any.whl
Binary files differ
diff --git a/virtualenv_support/wheel-0.24.0-py2.py3-none-any.whl b/virtualenv_support/wheel-0.26.0-py2.py3-none-any.whl
index 3355a17..ac025cb 100644
--- a/virtualenv_support/wheel-0.24.0-py2.py3-none-any.whl
+++ b/virtualenv_support/wheel-0.26.0-py2.py3-none-any.whl
Binary files differ