Bug 1100925 - bin_path method of virtualenv.py in mozbuild now accurately detects if virtualenv is in a windows system. r?gps draft
authorNathan Hakkakzadeh <nhakkakzadeh@mozilla.com>
Thu, 02 Jun 2016 12:26:47 -0700
changeset 387330 703c049429ef1e39875974f5a262496590ec2c5b
parent 387329 a4a33d2c6f405bbefcf2f0416da0c94f2c788933
child 387331 b147f21757d83c0d23a24766d40184bce2097689
push id22942
push userbmo:nhakkakzadeh@mozilla.com
push dateWed, 13 Jul 2016 21:21:35 +0000
reviewersgps
bugs1100925
milestone50.0a1
Bug 1100925 - bin_path method of virtualenv.py in mozbuild now accurately detects if virtualenv is in a windows system. r?gps Before bin_path would detect msys2 as if it were a windows system which would cause a virtualenv problem since the binaries should go in a /bin folder not a /Scripts folder for msys2. Based on a patch by :vlad https://github.com/vvuk/mc-hg/commit/89b21efe938af375f8f7971e7e3bb2aa0ecbde2a MozReview-Commit-ID: IyAukszHGmN
python/mozbuild/mozbuild/virtualenv.py
--- a/python/mozbuild/mozbuild/virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -11,16 +11,19 @@ import distutils.sysconfig
 import os
 import shutil
 import subprocess
 import sys
 import warnings
 
 from distutils.version import LooseVersion
 
+IS_NATIVE_WIN = (sys.platform == 'win32' and os.sep == '\\')
+IS_MSYS2 = (sys.platform == 'win32' and os.sep == '/')
+IS_CYGWIN = (sys.platform == 'cygwin')
 
 # Minimum version of Python required to build.
 MINIMUM_PYTHON_VERSION = LooseVersion('2.7.3')
 MINIMUM_PYTHON_MAJOR = 2
 
 
 UPGRADE_WINDOWS = '''
 Please upgrade to the latest MozillaBuild development environment. See
@@ -67,17 +70,17 @@ class VirtualenvManager(object):
             'virtualenv.py')
 
     @property
     def bin_path(self):
         # virtualenv.py provides a similar API via path_locations(). However,
         # we have a bit of a chicken-and-egg problem and can't reliably
         # import virtualenv. The functionality is trivial, so just implement
         # it here.
-        if sys.platform in ('win32', 'cygwin'):
+        if IS_CYGWIN or IS_NATIVE_WIN:
             return os.path.join(self.virtualenv_root, 'Scripts')
 
         return os.path.join(self.virtualenv_root, 'bin')
 
     @property
     def python_path(self):
         binary = 'python'
         if sys.platform in ('win32', 'cygwin'):