dev-python/virtualenv: Clean old versions up

This commit is contained in:
Michał Górny
2017-05-03 08:25:47 +02:00
parent 322242e14e
commit 737af3adb6
7 changed files with 0 additions and 357 deletions

View File

@@ -1,4 +1 @@
DIST virtualenv-13.1.2.tar.gz 1704701 SHA256 438a9933dac2e6ef2e4270fe82435f9c29f933f05e2c5840a7b45e342b6292f8 SHA512 e58f0b1d46174d61b0ef6703020806208f34291c5490fabf29d3b82a03ba89a7caeb377aac44549f6c0ffe2e445786e16dcd67593b7b8d3b1fae0d9e8c8ef124 WHIRLPOOL 03fe0181ebb2d4becb357a740cc3f743526a087e03c03f5e20abac6a54a2701865c89f9f6023ae996d3ca032b08d28e1048747dc8ea1740316f330180f0f5161
DIST virtualenv-14.0.6.tar.gz 1799312 SHA256 ce61e5d05e3532a8d910663c5ab92ed4c226c3daaba903f1ada281d96fabec98 SHA512 86fae16be973c8a981b106b22fec74909de225b70b7a486108ae769385a573087d64beb8963373f35a444a9baf0a1805c0035313f600655629dd8a03850c51fb WHIRLPOOL f4891ac11d2d2ca889e6b2eea4256c8f8628a59e205a20c022e050e37d3baebde221dcbb02fae7cdeb8d088d1dad30734a1471d37b658b7f13c3895287bc4769
DIST virtualenv-15.0.3.tar.gz 1847120 SHA256 8b230f01701eee0bfa45a7dc6ff19397abd92c3d50728f08e2236754797fdc01 SHA512 2d7223d59062dae7da8e81ca0463e4dd526faee01b48d2c42e39d7ada328a819e454a96c2380c200dba434f62a7cb1c612eff13815306837f2362bc5e658bae0 WHIRLPOOL c4c4539b44e05f234bd6fdfbb6568159a5b55edfd81e4920dbb4f1606dd8e77f5696c818afa8e1bc4eac28600303a5b2da1418fb3e730c64c7c5489f912d4b68
DIST virtualenv-15.1.0.tar.gz 1865011 SHA256 aea627d114a3863d6374c5a3fc3cdd08907e0ac951cf93b458e5ba5998c516de SHA512 46c313fe855483cf42def0ddb319df7513bb00ea2c1570efaf1236b4e0074df40d574f3858a3d3760db988b9021ca2046c40a355cc5a3ae32a2802d6120bf255 WHIRLPOOL de8dd66fdd004ad9c8e866eaa7bcd701b16b6f7c185ebe73a7681b3600ae4f55996b9f8e321ef51bf85046283a2e4bf948ffe2b10218190ecb334351f92c57b3

View File

@@ -1,10 +0,0 @@
--- pypa-virtualenv-350c45d/setup.py
+++ pypa-virtualenv-350c45d/setup.py
@@ -9,7 +9,6 @@
'entry_points': {
'console_scripts': [
'virtualenv=virtualenv:main',
- 'virtualenv-%s.%s=virtualenv:main' % sys.version_info[:2]
],
},
'zip_safe': False,

View File

@@ -1,144 +0,0 @@
docs/changes.rst | 3 ++
virtualenv.py | 92 +++++++++++++++++++++++++++++---------------------------
2 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/docs/changes.rst b/docs/changes.rst
index 80c3dc1..1d9c1fe 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -1,6 +1,9 @@
Release History
===============
+* Remove virtualenv file's path from directory when executing with a new
+ python. Fixes issue #779, #763 (PR #805)
+
13.1.2 (2015-08-23)
~~~~~~~~~~~~~~~~~~~
diff --git a/virtualenv.py b/virtualenv.py
index da25205..64e70d4 100755
--- a/virtualenv.py
+++ b/virtualenv.py
@@ -5,9 +5,22 @@
__version__ = "13.1.2"
virtualenv_version = __version__ # legacy
-import base64
-import sys
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'):
+ del_paths = []
+ for path in sys.path:
+ if os.path.realpath(os.path.dirname(__file__)) == os.path.realpath(path):
+ del_paths.append(path)
+ for path in del_paths:
+ sys.path.remove(path)
+
+import base64
import codecs
import optparse
import re
@@ -23,6 +36,11 @@ import struct
import subprocess
import tarfile
+try:
+ import ConfigParser
+except ImportError:
+ import configparser as ConfigParser
+
if sys.version_info < (2, 6):
print('ERROR: %s' % sys.exc_info()[1])
print('ERROR: this script requires Python 2.6 or greater.')
@@ -33,11 +51,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])
@@ -1096,45 +1109,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):

View File

@@ -1,51 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 )
inherit distutils-r1
DESCRIPTION="Virtual Python Environment builder"
HOMEPAGE="
http://www.virtualenv.org/
https://pypi.python.org/pypi/virtualenv
https://github.com/pypa/virtualenv/
"
SRC_URI="https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
IUSE="doc test"
RDEPEND=""
DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pytest[${PYTHON_USEDEP}]
)"
DOCS=( docs/index.rst docs/changes.rst )
PATCHES=(
"${FILESDIR}"/${PN}-1.8.2-no-versioned-script.patch
"${FILESDIR}"/${PN}-12.1.1-skip-broken-test.patch
"${FILESDIR}"/${P}-PYTHONPATH-backport.patch
)
python_compile_all() {
use doc && emake -C docs html
}
python_test() {
py.test -v -v || die "Tests fail with ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( "${S}"/docs/_build/html/. )
distutils-r1_python_install_all
}

View File

@@ -1,50 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 )
inherit distutils-r1
DESCRIPTION="Virtual Python Environment builder"
HOMEPAGE="
http://www.virtualenv.org/
https://pypi.python.org/pypi/virtualenv
https://github.com/pypa/virtualenv/
"
SRC_URI="https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
IUSE="doc test"
RDEPEND=""
DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pytest[${PYTHON_USEDEP}]
)"
DOCS=( docs/index.rst docs/changes.rst )
PATCHES=(
"${FILESDIR}"/${PN}-1.8.2-no-versioned-script.patch
"${FILESDIR}"/${PN}-12.1.1-skip-broken-test.patch
)
python_compile_all() {
use doc && emake -C docs html
}
python_test() {
py.test -v -v || die "Tests fail with ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( "${S}"/docs/_build/html/. )
distutils-r1_python_install_all
}

View File

@@ -1,50 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
inherit distutils-r1
DESCRIPTION="Virtual Python Environment builder"
HOMEPAGE="
http://www.virtualenv.org/
https://pypi.python.org/pypi/virtualenv
https://github.com/pypa/virtualenv/
"
SRC_URI="https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
IUSE="doc test"
RDEPEND=""
DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pytest[${PYTHON_USEDEP}]
)"
DOCS=( docs/index.rst docs/changes.rst )
PATCHES=(
"${FILESDIR}"/${PN}-1.8.2-no-versioned-script.patch
"${FILESDIR}"/${PN}-12.1.1-skip-broken-test.patch
)
python_compile_all() {
use doc && emake -C docs html
}
python_test() {
py.test -v -v || die "Tests fail with ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( "${S}"/docs/_build/html/. )
distutils-r1_python_install_all
}

View File

@@ -1,49 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
inherit distutils-r1
DESCRIPTION="Virtual Python Environment builder"
HOMEPAGE="
http://www.virtualenv.org/
https://pypi.python.org/pypi/virtualenv
https://github.com/pypa/virtualenv/
"
SRC_URI="https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
IUSE="doc test"
RDEPEND=""
DEPEND="${RDEPEND}
>=dev-python/setuptools-19.6.2[${PYTHON_USEDEP}]
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? (
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pytest[${PYTHON_USEDEP}]
)"
DOCS=( docs/index.rst docs/changes.rst )
PATCHES=(
"${FILESDIR}"/${PN}-12.1.1-skip-broken-test.patch
)
python_compile_all() {
use doc && emake -C docs html
}
python_test() {
py.test -v -v || die "Tests fail with ${EPYTHON}"
}
python_install_all() {
use doc && local HTML_DOCS=( docs/_build/html/. )
distutils-r1_python_install_all
}