Commits

holger krekel  committed 50bd500

refine python2.5 and install_command behaviour and documentation. also show i in "--showconfig"
and rename internally from "install_command_argv" to install_command for consistency.

also deprecate downloadcache, distribute settings.

  • Participants
  • Parent commits 4949def

Comments (0)

Files changed (8)

 1.6.0.dev
 -----------------
 
+- fix issue35: add new EXPERIMENTAL "install_command" testenv-option to configure the
+  installation command with options for dep/pkg install.  Thanks Carl Meyer
+  for the PR and docs.
+
+
+- address issueintroduce python2.5 support by vendoring the virtualenv-1.9.1 script
+  and forcing pip<1.4. Also the default [py25] environment modifies the
+  default installer_command (new config option) to use pip without the "--pre" 
+  which was introduced with pip-1.4 and is required if you want to install non-stable releases.
+  (tox defaults to install with "--pre" otherwise).
+
 - fix issue1: empty setup files are properly detected, thanks Anthon van
   der Neuth
 
 
 - remove toxbootstrap.py for now because it is broken.
 
-- fix issue35: add new "install_command" testenv-option to configure the
-  installation command with options for dep/pkg install.  Thanks Carl Meyer
-  for the PR and docs.
-
 - fix issue109 and fix issue111: multiple "-e" options are now combined
   (previously the last one would win). Thanks Anthon van der Neut.
 

File doc/config.txt

 
     .. versionadded:: 1.6
 
-    the command to be used for installing packages into the virtual
-    environment; both the sdist for the package under test and any
-    defined dependencies. Must contain the substitution key
+    **WARNING**: This setting is **EXPERIMENTAL** so use with care 
+    and be ready to adapt your tox.ini's with post-1.6 tox releases.
+
+    the ``install_command`` setting is used for installing packages into
+    the virtual environment; both the package under test
+    and any defined dependencies. Must contain the substitution key
     ``{packages}`` which will be replaced by the packages to
     install. May also contain the substitution key ``{opts}``, which
     will be replaced by the ``-i`` option to specify index server
     :confval:`downloadcache`, and/or your :confval:`install_command`
     should not include the ``{opts}`` substitution key (in which case
     those options will have no effect).
-    **default**: ``pip install {opts} {packages}``
+    **default**::
+    
+        pip install --pre {opts} {packages}
+
+    **default on environment names containing 'py25'**::
+
+        pip install --insecure {opts} {packages}`` 
+
+    (this will use pip<1.4 (so no "--pre" option) and 
+    python2.5 typically has no SSL support).
 
 .. confval:: whitelist_externals=MULTI-LINE-LIST
 
 
 .. confval:: downloadcache=path
 
+    **DEPRECATED** -- as of August 2013 this option is not very
+    useful because of pypi's CDN and because of caching pypi
+    server solutions like `devpi <http://doc.devpi.net>`_.
+
     use this directory for caching downloads.  This value is overriden
     by the environment variable ``PIP_DOWNLOAD_CACHE`` if it exists. If
     you specify a custom :confval:`install_command` that uses an
     installer other than pip, your installer must support the
     `--download-cache` command-line option.
     **default**: no download cache will be used.
-    **note**: if creating multiple environments use of a download cache greatly
-    speeds up the testing process.
 
 .. confval:: distribute=True|False
 
-    Set to ``True`` if you want to use distribute_ instead of the default
-    setuptools_ in the virtual environment.  Prior to tox-1.5 the
-    default was True and now is False, meaning ``setuptools`` is used 
-    (note that setuptools-0.7 merged with distribute).  In future versions 
-    of tox this option might be ignored and setuptools always chosen.
+    **DEPRECATED** -- as of August 2013 you should use setuptools
+    which has merged most of distribute_ 's changes.  Just use
+    the default, Luke!  In future versions of tox this option might 
+    be ignored and setuptools always chosen.  
+
     **default:** False.
 
 .. confval:: sitepackages=True|False
 
     Set to ``True`` if you want to create virtual environments that also
-    have access to globally installed packages.  **default:** False, meaning
-    that virtualenvs will be created with ``--no-site-packages`` by default.
+    have access to globally installed packages.  
+
+    **default:** False, meaning that virtualenvs will be 
+    created without inheriting the global site packages.
 
 .. confval:: args_are_paths=BOOL
 
     treat positional arguments passed to ``tox`` as file system paths
     and - if they exist on the filesystem - rewrite them according
     to the ``changedir``.
-    **default**: True (due to the exists-on-filesystem check it's usually
-    safe to try rewriting).
+    **default**: True (due to the exists-on-filesystem check it's 
+    usually safe to try rewriting).
 
 .. confval:: envtmpdir=path
 

File tests/test_config.py

         assert envconfig.changedir.basename == "abc"
         assert envconfig.changedir == config.setupdir.join("abc")
 
-    def test_install_command(self, newconfig):
+    def test_install_command_defaults_py25(self, newconfig):
+        config = newconfig("""
+            [testenv:py25]
+            [testenv:py25-x]
+            [testenv:py26]
+        """)
+        for name in ("py25", "py25-x"):
+            env = config.envconfigs[name]
+            assert env.install_command == \
+               "pip install --insecure {opts} {packages}".split()
+        env = config.envconfigs["py26"]
+        assert env.install_command == \
+               "pip install --pre {opts} {packages}".split()
+
+    def test_install_command_setting(self, newconfig):
         config = newconfig("""
             [testenv]
-            install_command=pip install --pre {packages}
+            install_command=some_install {packages}
         """)
         envconfig = config.envconfigs['python']
-        assert envconfig.install_command_argv == [
-            'pip', 'install', '--pre', '{packages}']
+        assert envconfig.install_command == [
+            'some_install', '{packages}']
 
     def test_install_command_must_contain_packages(self, newconfig):
         py.test.raises(tox.exception.ConfigError, newconfig, """
         envconfig = config.envconfigs['python']
         assert envconfig.downloadcache == '/from/env'
 
-    def test_downloadcache_only_if_in_config(self, newconfig, tmpdir, monkeypatch):
+    def test_downloadcache_only_if_in_config(self, newconfig, tmpdir,
+                                             monkeypatch):
         monkeypatch.setenv("PIP_DOWNLOAD_CACHE", tmpdir)
         config = newconfig('')
         envconfig = config.envconfigs['python']
         config = newconfig(["-vv"], "")
         assert config.option.verbosity == 2
 
-    def test_substitution_jenkins_default(self, tmpdir, monkeypatch, newconfig):
+    def test_substitution_jenkins_default(self, tmpdir,
+                                          monkeypatch, newconfig):
         monkeypatch.setenv("HUDSON_URL", "xyz")
         config = newconfig("""
             [testenv:py24]

File tests/test_z_cmdline.py

 
 pytest_plugins = "pytester"
 
-if sys.version_info < (2,6):
-    PIP_INSECURE = "setenv = PIP_INSECURE=1"
-else:
-    PIP_INSECURE = ""
-
 from tox._cmdline import Session
 from tox._config import parseconfig
 
             'tox.ini': '''
                 [testenv]
                 changedir=tests
-                %s
-                commands= py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml
+                commands= py.test --basetemp={envtmpdir} \
+                                  --junitxml=junit-{envname}.xml
                 deps=pytest
-            ''' % PIP_INSECURE
+            '''
         })
 
     def test_toxuone_env(self, cmd, example123):
             [testenv]
             usedevelop=True
             changedir=tests
-            %s
             commands=
                 py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml []
             deps=pytest
-        ''' % PIP_INSECURE
+        '''
     })
     result = cmd.run("tox", "-v")
     assert not result.ret
         # content of: tox.ini
         [testenv]
         commands=pip -h
-        [testenv:py25]
+        [testenv:py26]
         basepython=python
-        [testenv:py26]
+        [testenv:py27]
         basepython=python
     """})
     result = cmd.run("tox")
 def test_notest(initproj, cmd):
     initproj("example123", filedefs={'tox.ini': """
         # content of: tox.ini
-        [testenv:py25]
+        [testenv:py26]
         basepython=python
     """})
     result = cmd.run("tox", "-v", "--notest")
     assert not result.ret
     result.stdout.fnmatch_lines([
         "*summary*",
-        "*py25*skipped tests*",
+        "*py26*skipped tests*",
     ])
-    result = cmd.run("tox", "-v", "--notest", "-epy25")
+    result = cmd.run("tox", "-v", "--notest", "-epy26")
     assert not result.ret
     result.stdout.fnmatch_lines([
-        "*py25*reusing*",
+        "*py26*reusing*",
     ])
 
 def test_PYC(initproj, cmd, monkeypatch):
 commands=py.test  --junitxml={envlogdir}/junit-{envname}.xml {posargs}
 deps=pytest>=2.3.5
 
-[testenv:py25]   # requires virtualenv-1.9.1
-setenvs =
-    PIP_INSECURE=True
-
 [testenv:docs]
 basepython=python
 changedir=doc

File tox/_cmdline.py

             self.report.line("  envlogdir=%s" % envconfig.envlogdir)
             self.report.line("  changedir=%s" % envconfig.changedir)
             self.report.line("  args_are_path=%s" % envconfig.args_are_paths)
+            self.report.line("  install_command=%s" %
+                             envconfig.install_command)
             self.report.line("  commands=")
             for command in envconfig.commands:
                 self.report.line("    %s" % command)

File tox/_config.py

     parser.add_argument("-v", nargs=0, action=CountAction, default=0,
         dest="verbosity",
         help="increase verbosity of reporting output.")
-    parser.add_argument("--showconfig", action="store_true", dest="showconfig",
-        help="show configuration information. ")
+    parser.add_argument("--showconfig", action="store_true",
+        help="show configuration information for all environments. ")
     parser.add_argument("-l", "--listenvs", action="store_true",
         dest="listenvs", help="show list of test environments")
     parser.add_argument("-c", action="store", default="tox.ini",
             # env var, if present, takes precedence
             downloadcache = os.environ.get("PIP_DOWNLOAD_CACHE", downloadcache)
             vc.downloadcache = py.path.local(downloadcache)
-        vc.install_command_argv = reader.getargv(
+
+        # on python 2.5 we can't use "--pre" and we typically
+        # need to use --insecure for pip commands because python2.5
+        # doesn't support SSL
+        pip_default_opts = ["{opts}", "{packages}"]
+        if "py25" in vc.envname:  # XXX too rough check for "python2.5"
+            pip_default_opts.insert(0, "--insecure")
+        else:
+            pip_default_opts.insert(0, "--pre")
+        vc.install_command = reader.getargv(
             section,
             "install_command",
-            "pip install {opts} {packages}",
+            "pip install " + " ".join(pip_default_opts),
             replace=False,
             )
-        if '{packages}' not in vc.install_command_argv:
+        if '{packages}' not in vc.install_command:
             raise tox.exception.ConfigError(
-                "'install_command' must contain '{packages}' substitution")
+             "'install_command' must contain '{packages}' substitution")
         return vc
 
     def _getenvlist(self, reader, toxsection):

File tox/_venv.py

 
     def run_install_command(self, args, indexserver=None, action=None,
                             extraenv=None):
-        argv = self.envconfig.install_command_argv[:]
+        argv = self.envconfig.install_command[:]
         # use pip-script on win32 to avoid the executable locking
         if argv[0] == "pip" and sys.platform == "win32":
             argv[0] = "pip-script.py"