Skip to content

Commit 30ee22f

Browse files
committed
hacked attempt to get round MSYS_HOME environ dependency on windows/git-bash/msys
1 parent 897ae17 commit 30ee22f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

virtualenvwrapper/user_scripts.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@
2626
script_folder = 'bin'
2727

2828

29+
def _get_msys_shell():
30+
if 'MSYS_HOME' in os.environ:
31+
return [get_path(os.environ['MSYS_HOME'], 'bin', 'sh.exe')]
32+
else:
33+
for path in os.environ['PATH'].split(';'):
34+
if os.path.exists(os.path.join(path, 'sh.exe')):
35+
return [get_path(path, 'sh.exe')]
36+
raise Exception('Could not find sh.exe')
37+
38+
2939
def run_script(script_path, *args):
3040
"""Execute a script in a subshell.
3141
"""
3242
if os.path.exists(script_path):
3343
cmd = [script_path] + list(args)
3444
if is_msys:
35-
cmd = [get_path(os.environ['MSYS_HOME'], 'bin', 'sh.exe')] + cmd
45+
cmd = _get_msys_shell() + cmd
3646
log.debug('running %s', str(cmd))
3747
try:
3848
subprocess.call(cmd)

0 commit comments

Comments
 (0)