[Pytest-commit] commit/tox: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Aug 14 08:05:22 CEST 2013
3 new commits in tox:
https://bitbucket.org/hpk42/tox/commits/5e3344f746e7/
Changeset: 5e3344f746e7
Branch: use-venv191-pip13-for-python25
User: mete0r_kr
Date: 2013-08-13 19:32:35
Summary: use inlined virtualenv-1.9.1 and pip<1.4 for CPython 2.5 / Jython 2.5
Since virtualenv 1.10 and pip 1.4 has dropped python 2.5 support, use inlined virtualenv-1.9.1 and Pip<1.4 for CPython 2.5 / Jython 2.5
Affected #: 2 files
diff -r 3be5bca16f8b0c4394060b8e0377ef1883c518c7 -r 5e3344f746e7954a06ac56c50cc8ff4359f95576 tests/test_venv.py
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -4,6 +4,7 @@
import os, sys
from tox._venv import VirtualEnv, CreationConfig, getdigest
from tox._venv import find_executable
+from tox._venv import _getinterpreterversion
#def test_global_virtualenv(capfd):
# v = VirtualEnv()
@@ -80,6 +81,11 @@
py.test.raises(tox.exception.InterpreterNotFound,
venv.getsupportedinterpreter)
+def test_getinterpreterversion():
+ from distutils.sysconfig import get_python_version
+ version = _getinterpreterversion(sys.executable)
+ assert version == get_python_version()
+
def test_create(monkeypatch, mocksession, newconfig):
config = newconfig([], """
[testenv:py123]
diff -r 3be5bca16f8b0c4394060b8e0377ef1883c518c7 -r 5e3344f746e7954a06ac56c50cc8ff4359f95576 tox/_venv.py
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -1,5 +1,7 @@
from __future__ import with_statement
import sys, os, re
+import textwrap
+import subprocess
import py
import tox
from tox._config import DepConfig
@@ -180,10 +182,15 @@
if action is None:
action = self.session.newaction(self, "create")
config_interpreter = self.getsupportedinterpreter()
- f, path, _ = py.std.imp.find_module("virtualenv")
- f.close()
- venvscript = path.rstrip("co")
- #venvscript = py.path.local(tox.__file__).dirpath("virtualenv.py")
+ config_interpreter_version = _getinterpreterversion(config_interpreter)
+ use_venv191 = config_interpreter_version < '2.6'
+ use_pip13 = config_interpreter_version < '2.6'
+ if not use_venv191:
+ f, path, _ = py.std.imp.find_module("virtualenv")
+ f.close()
+ venvscript = path.rstrip("co")
+ else:
+ venvscript = py.path.local(tox.__file__).dirpath("virtualenv-1.9.1.py")
args = [config_interpreter, venvscript]
if self.envconfig.distribute:
args.append("--distribute")
@@ -204,6 +211,12 @@
args.append(self.path.basename)
self._pcall(args, venv=False, action=action, cwd=basepath)
self.just_created = True
+ if use_pip13:
+ indexserver = self.envconfig.config.indexserver['default']
+ action = self.session.newaction(self, "pip_downgrade")
+ action.setactivity('pip-downgrade', 'pip<1.4')
+ argv = ["easy_install"] + self._commoninstallopts(indexserver) + ['pip<1.4']
+ self._pcall(argv, cwd=self.envconfig.envlogdir, action=action)
def finish(self):
self._getliveconfig().writeconfig(self.path_config)
@@ -366,6 +379,23 @@
self.session.report.verbosity2("setting PATH=%s" % os.environ["PATH"])
return oldPATH
+def _getinterpreterversion(executable):
+ print_python_version = textwrap.dedent("""
+ from distutils.sysconfig import get_python_version
+ print(get_python_version())
+ """)
+ proc = subprocess.Popen([str(executable), '-c', print_python_version],
+ stdout=subprocess.PIPE)
+ odata, edata = proc.communicate()
+ if proc.returncode:
+ raise tox.exception.UnsupportedInterpreter(
+ "Error getting python version from %s" % executable)
+ if sys.version_info[0] == 3:
+ string = str
+ else:
+ string = lambda x, encoding: str(x)
+ return string(odata, 'ascii').strip()
+
def getdigest(path):
path = py.path.local(path)
if not path.check(file=1):
https://bitbucket.org/hpk42/tox/commits/42280ff26e8c/
Changeset: 42280ff26e8c
Branch: use-venv191-pip13-for-python25
User: mete0r_kr
Date: 2013-08-13 22:48:03
Summary: Add missing virtualenv-1.9.1.py and fix to use indexserver.url
and remove textwrap usage
Affected #: 2 files
diff -r 5e3344f746e7954a06ac56c50cc8ff4359f95576 -r 42280ff26e8c7eb31eea06d3b550664bb56407a4 tox/_venv.py
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -1,6 +1,5 @@
from __future__ import with_statement
import sys, os, re
-import textwrap
import subprocess
import py
import tox
@@ -212,7 +211,7 @@
self._pcall(args, venv=False, action=action, cwd=basepath)
self.just_created = True
if use_pip13:
- indexserver = self.envconfig.config.indexserver['default']
+ indexserver = self.envconfig.config.indexserver['default'].url
action = self.session.newaction(self, "pip_downgrade")
action.setactivity('pip-downgrade', 'pip<1.4')
argv = ["easy_install"] + self._commoninstallopts(indexserver) + ['pip<1.4']
@@ -380,10 +379,9 @@
return oldPATH
def _getinterpreterversion(executable):
- print_python_version = textwrap.dedent("""
- from distutils.sysconfig import get_python_version
- print(get_python_version())
- """)
+ print_python_version = (
+ 'from distutils.sysconfig import get_python_version\n'
+ 'print(get_python_version())\n')
proc = subprocess.Popen([str(executable), '-c', print_python_version],
stdout=subprocess.PIPE)
odata, edata = proc.communicate()
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/hpk42/tox/commits/2f81a12f84bc/
Changeset: 2f81a12f84bc
User: hpk42
Date: 2013-08-14 08:05:21
Summary: ref issue91 - use a vendored virtualenv-1.9.1 when creating python-2.5 environments.
Merged in mete0r_kr/tox/use-venv191-pip13-for-python25 (pull request #65)
use inlined virtualenv-1.9.1 and pip<1.4 for CPython 2.5 / Jython 2.5 (revised)
Affected #: 3 files
diff -r e4fd16d2b53588a3b65c19dd194797f89bba7f68 -r 2f81a12f84bc87215c4c5862c3555111b5ab1991 tests/test_venv.py
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -4,6 +4,7 @@
import os, sys
from tox._venv import VirtualEnv, CreationConfig, getdigest
from tox._venv import find_executable
+from tox._venv import _getinterpreterversion
#def test_global_virtualenv(capfd):
# v = VirtualEnv()
@@ -80,6 +81,11 @@
py.test.raises(tox.exception.InterpreterNotFound,
venv.getsupportedinterpreter)
+def test_getinterpreterversion():
+ from distutils.sysconfig import get_python_version
+ version = _getinterpreterversion(sys.executable)
+ assert version == get_python_version()
+
def test_create(monkeypatch, mocksession, newconfig):
config = newconfig([], """
[testenv:py123]
diff -r e4fd16d2b53588a3b65c19dd194797f89bba7f68 -r 2f81a12f84bc87215c4c5862c3555111b5ab1991 tox/_venv.py
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -1,5 +1,6 @@
from __future__ import with_statement
import sys, os, re
+import subprocess
import py
import tox
from tox._config import DepConfig
@@ -180,10 +181,15 @@
if action is None:
action = self.session.newaction(self, "create")
config_interpreter = self.getsupportedinterpreter()
- f, path, _ = py.std.imp.find_module("virtualenv")
- f.close()
- venvscript = path.rstrip("co")
- #venvscript = py.path.local(tox.__file__).dirpath("virtualenv.py")
+ config_interpreter_version = _getinterpreterversion(config_interpreter)
+ use_venv191 = config_interpreter_version < '2.6'
+ use_pip13 = config_interpreter_version < '2.6'
+ if not use_venv191:
+ f, path, _ = py.std.imp.find_module("virtualenv")
+ f.close()
+ venvscript = path.rstrip("co")
+ else:
+ venvscript = py.path.local(tox.__file__).dirpath("virtualenv-1.9.1.py")
args = [config_interpreter, venvscript]
if self.envconfig.distribute:
args.append("--distribute")
@@ -204,6 +210,12 @@
args.append(self.path.basename)
self._pcall(args, venv=False, action=action, cwd=basepath)
self.just_created = True
+ if use_pip13:
+ indexserver = self.envconfig.config.indexserver['default'].url
+ action = self.session.newaction(self, "pip_downgrade")
+ action.setactivity('pip-downgrade', 'pip<1.4')
+ argv = ["easy_install"] + self._commoninstallopts(indexserver) + ['pip<1.4']
+ self._pcall(argv, cwd=self.envconfig.envlogdir, action=action)
def finish(self):
self._getliveconfig().writeconfig(self.path_config)
@@ -372,6 +384,22 @@
self.session.report.verbosity2("setting PATH=%s" % os.environ["PATH"])
return oldPATH
+def _getinterpreterversion(executable):
+ print_python_version = (
+ 'from distutils.sysconfig import get_python_version\n'
+ 'print(get_python_version())\n')
+ proc = subprocess.Popen([str(executable), '-c', print_python_version],
+ stdout=subprocess.PIPE)
+ odata, edata = proc.communicate()
+ if proc.returncode:
+ raise tox.exception.UnsupportedInterpreter(
+ "Error getting python version from %s" % executable)
+ if sys.version_info[0] == 3:
+ string = str
+ else:
+ string = lambda x, encoding: str(x)
+ return string(odata, 'ascii').strip()
+
def getdigest(path):
path = py.path.local(path)
if not path.check(file=1):
This diff is so big that we needed to truncate the remainder.
Repository URL: https://bitbucket.org/hpk42/tox/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list