Skip to content

Commit

Permalink
Fix running executables in conda/virtualenv environments on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pv committed Jun 27, 2015
1 parent 37ab4aa commit 6803151
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 13 additions & 2 deletions asv/plugins/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from .. import util


WIN = (os.name == "nt")


class Conda(environment.Environment):
"""
Manage an environment using conda.
Expand Down Expand Up @@ -120,8 +123,16 @@ def _install_requirements(self):
self._run_executable('conda', args)

def _run_executable(self, executable, args, **kwargs):
return util.check_output([
os.path.join(self._path, 'bin', executable)] + args, **kwargs)
if WIN:
executable += ".exe"

exe = os.path.join(self._path, 'bin', executable)
if WIN and not os.path.isfile(exe):
exe = os.path.join(self._path, 'Scripts', executable)
if not os.path.isfile(exe):
exe = os.path.join(self._path, executable)

return util.check_output([exe] + args, **kwargs)

def install(self, package):
log.info("Installing into {0}".format(self.name))
Expand Down
8 changes: 7 additions & 1 deletion asv/plugins/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,15 @@ def _install_requirements(self):
self._run_executable('pip', args)

def _run_executable(self, executable, args, **kwargs):
if WIN:
executable += ".exe"

exe = os.path.join(self._path, 'bin', executable)
if WIN and not os.path.isfile(exe):
exe = os.path.join(self._path, 'Scripts', executable + '.exe')
exe = os.path.join(self._path, 'Scripts', executable)
if not os.path.isfile(exe):
exe = os.path.join(self._path, executable)

return util.check_output([exe] + args, **kwargs)

def install(self, package):
Expand Down

0 comments on commit 6803151

Please sign in to comment.