Commits

Carl Meyer  committed 136e0f1

Add --download-cache if set in config; don't try to check installer.

  • Participants
  • Parent commits c5bf99a

Comments (0)

Files changed (2)

File doc/config.txt

     install. May also contain the substitution key ``{opts}``, which
     will be replaced by the ``-i`` option to specify index server
     (according to :confval:`indexserver` and the ``:indexserver:dep``
-    syntax of :confval:`deps`) and the ``--download-cache`` option, if
-    you've specified :confval:`downloadcache` and your
-    :confval:`install_command` begins with ``pip``.  **default**: ``pip
-    install {opts} {packages}``
+    syntax of :confval:`deps`) and the ``--download-cache`` option (if
+    you've specified :confval:`downloadcache`). If your installer does
+    not support ``-i`` and ``--download-cache`` command-line options,
+    you should not use :confval:`indexserver` or
+    :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}``
 
 .. confval:: whitelist_externals=MULTI-LINE-LIST
 
 
 .. confval:: downloadcache=path
 
-    (pip only) use this directory for caching downloads.  This value
-    is overriden by the environment variable ``PIP_DOWNLOAD_CACHE``
-    if it exists.
+    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.

File tox/_venv.py

                 "%s" % depinfo)
             self._install(deps, action=action)
 
-    def _installopts(self, indexserver, is_pip):
+    def _installopts(self, indexserver):
         l = []
         if indexserver:
             l += ["-i", indexserver]
-        if is_pip and self.envconfig.downloadcache:
+        if self.envconfig.downloadcache:
             self.envconfig.downloadcache.ensure(dir=1)
             l.append("--download-cache=%s" % self.envconfig.downloadcache)
         return l
 
     def run_install_command(self, args, indexserver=None, action=None):
         argv = self.envconfig.install_command_argv[:]
-        is_pip = False
-        if argv[0] == "pip":
-            is_pip = True
-            # use pip-script on win32 to avoid the executable locking
-            if sys.platform == "win32":
-                argv[0] = "pip-script.py"
+        # use pip-script on win32 to avoid the executable locking
+        if argv[0] == "pip" and sys.platform == "win32":
+            argv[0] = "pip-script.py"
         i = argv.index('{packages}')
         argv[i:i+1] = args
         if '{opts}' in argv:
             i = argv.index('{opts}')
-            argv[i:i+1] = self._installopts(indexserver, is_pip)
+            argv[i:i+1] = self._installopts(indexserver)
         for x in ('PIP_RESPECT_VIRTUALENV', 'PIP_REQUIRE_VIRTUALENV'):
             try:
                 del os.environ[x]