Bug 1100925 - bin_path method of virtualenv.py in mozbuild now accurately detects if virtualenv is in a windows system. r=gps
authorNathan Hakkakzadeh <nhakkakzadeh@mozilla.com>
Thu, 02 Jun 2016 12:26:47 -0700
changeset 305192 e23500a00972160ea77c15b255193d07960fb328
parent 305191 2dfcc10b2e94cf228e7ad1760de156c6bf9bcfd6
child 305193 bbd6316e775c989ec9c594fa26419cc8df0953b0
push id79518
push usercbook@mozilla.com
push dateSun, 17 Jul 2016 08:09:59 +0000
treeherdermozilla-inbound@711963e8daa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1100925
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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'):