Commits

holger krekel  committed eb83611

fix issue130: you can now set install_command=easy_install {opts} {packages}
and expect it to run without the need to recreate. Thanks jenisys for
precise reporting.

  • Participants
  • Parent commits ca1c1d8

Comments (0)

Files changed (3)

 1.6.2.dev
 ---------
 
+- fix issue130: you can now set install_command=easy_install {opts} {packages}
+  and expect it to run without the need to recreate.  Thanks jenisys for
+  precise reporting. 
+
 - fix issue129: tox now uses Popen(..., universal_newlines=True) to force 
   creation of unicode stdout/stderr streams.  fixes a problem on specific
   platform configs when creating virtualenvs with Python3.3. Thanks Jorgen Schäfer

File tests/test_venv.py

     mocksession.installpkg(venv, pkg)
     l = mocksession._pcalls
     assert len(l) == 1
-    assert '-U' in l[0].args
-    assert '--no-deps' in l[0].args
+    index = l[0].args.index(str(pkg))
+    assert index >= 0
+    assert '-U' in l[0].args[:index]
+    assert '--no-deps' in l[0].args[:index]
 
 def test_run_install_command(newmocksession):
     mocksession = newmocksession([], "")
     venv.just_created = True
     venv.envconfig.envdir.ensure(dir=1)
     action = mocksession.newaction(venv, "hello")
-    venv.run_install_command(args=["whatever"], action=action)
+    venv.run_install_command(packages=["whatever"], action=action)
     l = mocksession._pcalls
     assert len(l) == 1
     assert 'pip' in l[0].args[0]
     venv.just_created = True
     venv.envconfig.envdir.ensure(dir=1)
     action = mocksession.newaction(venv, "hello")
-    venv.run_install_command(args=["whatever"], action=action)
+    venv.run_install_command(packages=["whatever"], action=action)
     l = mocksession._pcalls
     assert len(l) == 1
     assert 'easy_install' in l[0].args[0]

File tox/_venv.py

             l.append("--download-cache=%s" % self.envconfig.downloadcache)
         return l
 
-    def run_install_command(self, args, indexserver=None, action=None,
+    def run_install_command(self, packages, options=(),
+                            indexserver=None, action=None,
                             extraenv=None):
         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"
         i = argv.index('{packages}')
-        argv[i:i+1] = args
+        argv[i:i+1] = packages
         if '{opts}' in argv:
             i = argv.index('{opts}')
-            argv[i:i+1] = self._installopts(indexserver)
+            argv[i:i+1] = list(options)
         for x in ('PIP_RESPECT_VIRTUALENV', 'PIP_REQUIRE_VIRTUALENV'):
             try:
                 del os.environ[x]
                 l.append(ixserver)
             assert ixserver.url is None or isinstance(ixserver.url, str)
 
-        extraopts = extraopts or []
         for ixserver in l:
             if self.envconfig.config.option.sethome:
                 extraenv = hack_home_env(
             else:
                 extraenv = {}
 
-            args = d[ixserver] + extraopts
-            self.run_install_command(args, ixserver.url, action,
-                                     extraenv=extraenv)
+            packages = d[ixserver]
+            options = self._installopts(ixserver.url)
+            if extraopts:
+                options.extend(extraopts)
+            self.run_install_command(packages=packages, options=options,
+                                     action=action, extraenv=extraenv)
 
     def _getenv(self):
         env = self.envconfig.setenv