From be2f2f58807fbcf15602b169d4057b6589cbbf79 Mon Sep 17 00:00:00 2001 From: Ionel Maries Cristian Date: Sat, 11 Jan 2014 17:59:44 +0200 Subject: Change tox to use the virtualenv bin instead of invoking it with the current interpreter. Virtualenv might have been installed with a completely different interpreter (and might not work at all!) or it could have other issues caused by invoking the module directly (virtualenv 1.11 known to break). Also add a `virtualenvbin` config option in case it need overriding. --- tests/test_venv.py | 7 ++----- tox/_config.py | 2 +- tox/_venv.py | 7 +------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/test_venv.py b/tests/test_venv.py index 0ac8f90..77181d1 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -48,11 +48,8 @@ def test_create(monkeypatch, mocksession, newconfig): l = mocksession._pcalls assert len(l) >= 1 args = l[0].args - assert "virtualenv" in str(args[1]) + assert str(args[0]).endswith("virtualenv") if sys.platform != "win32": - # realpath is needed for stuff like the debian symlinks - assert py.path.local(sys.executable).realpath() \ - == py.path.local(args[0]).realpath() #assert Envconfig.toxworkdir in args assert venv.getcommandpath("easy_install", cwd=py.path.local()) interp = venv._getliveconfig().python @@ -321,7 +318,7 @@ def test_install_python3(tmpdir, newmocksession): l = mocksession._pcalls assert len(l) == 1 args = l[0].args - assert str(args[1]).endswith('virtualenv.py') + assert str(args[0]).endswith('virtualenv') l[:] = [] action = mocksession.newaction(venv, "hello") venv._install(["hello"], action=action) diff --git a/tox/_config.py b/tox/_config.py index 6006fa9..928305c 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -357,6 +357,7 @@ class parseini: ixserver = None name = self._replace_forced_dep(name, config) vc.deps.append(DepConfig(name, ixserver)) + vc.virtualenvbin = reader.getdefault(section, "virtualenvbin", "virtualenv") vc.distribute = reader.getbool(section, "distribute", False) vc.sitepackages = self.config.option.sitepackages or \ reader.getbool(section, "sitepackages", False) @@ -734,4 +735,3 @@ def getcontextname(): if 'HUDSON_URL' in os.environ: return 'jenkins' return None - diff --git a/tox/_venv.py b/tox/_venv.py index 58093fc..4ed7b47 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -178,13 +178,8 @@ class VirtualEnv(object): if action is None: action = self.session.newaction(self, "create") - interpreters = self.envconfig.config.interpreters config_interpreter = self.getsupportedinterpreter() - info = interpreters.get_info(executable=config_interpreter) - f, path, _ = py.std.imp.find_module("virtualenv") - f.close() - venvscript = path.rstrip("co") - args = [config_interpreter, str(venvscript)] + args = [self.envconfig.virtualenvbin] if self.envconfig.distribute: args.append("--distribute") else: -- cgit v1.2.1