Browse files

Added support for using virtualenv from an MSYS/MinGW shell on Windows

  • Loading branch information...
1 parent 4838801 commit e44724bc5eb89ebb59971dd600addf0367f86165 @greghaskins committed Mar 26, 2011
Showing with 10 additions and 2 deletions.
  1. +10 −2 virtualenv.py
View
12 virtualenv.py
@@ -1165,8 +1165,16 @@ def install_activate(home_dir, bin_dir, prompt=None):
if sys.platform == 'win32' or is_jython and os._name == 'nt':
files = {'activate.bat': ACTIVATE_BAT,
'deactivate.bat': DEACTIVATE_BAT}
- if os.environ.get('OS') == 'Windows_NT' and os.environ.get('OSTYPE') == 'cygwin':
- files['activate'] = ACTIVATE_SH
+ if os.environ.get('OS') == 'Windows_NT':
+ if os.environ.get('OSTYPE') == 'cygwin':
+ files['activate'] = ACTIVATE_SH
+
+ elif os.environ.get('MSYSTEM') == 'MINGW32':
+ # MSYS needs paths of the form /c/path/to/file
+ drive, tail = os.path.splitdrive(os.path.abspath(home_dir).replace(os.sep, '/'))
+ home_dir_msys = (drive and '/%s%s' or '%s%s') % (drive[:1], tail)
@greghaskins
Owner

This should do the right thing with network shares (which start with slashes already). That's not something I've tested extensively, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ files['activate'] = ACTIVATE_SH.replace('__VIRTUAL_ENV__', home_dir_msys)
+
else:
files = {'activate': ACTIVATE_SH}

0 comments on commit e44724b

Please sign in to comment.