Bug 1275437 - Fixed some offending version checks that were inhereted from the BaseBootstrapper r?gps draft
authorNathan Hakkakzadeh <nhakkakzadeh@mozilla.com>
Tue, 31 May 2016 11:20:34 -0700
changeset 374688 e35115f3b42d0b8de0d8882970e7064c5f46293d
parent 374687 d5a66ea6da584605e5f184be044af1809bb93bb2
child 374689 8fdd6dbc0bdbebd20a2aba065d929574856075c4
push id20064
push userbmo:nhakkakzadeh@mozilla.com
push dateThu, 02 Jun 2016 19:38:21 +0000
reviewersgps
bugs1275437
milestone49.0a1
Bug 1275437 - Fixed some offending version checks that were inhereted from the BaseBootstrapper r?gps Overrode BaseBootstrapper.which to append '.exe' to any which checks since (hopefully) anything the bootstrapper looks for, must be a windows executable. Changed base bootstrapper class to use str instead of unicode to avoid a bug in the MinGW version of Python where subprocces.Popen will not accept environment variables that are in unicode instead of str. MozReview-Commit-ID: 4m8xNifawYS
python/mozboot/mozboot/base.py
python/mozboot/mozboot/windows.py
--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -294,17 +294,18 @@ class BaseBootstrapper(object):
     def _hgplain_env(self):
         """ Returns a copy of the current environment updated with the HGPLAIN
         environment variable.
 
         HGPLAIN prevents Mercurial from applying locale variations to the output
         making it suitable for use in scripts.
         """
         env = os.environ.copy()
-        env['HGPLAIN'] = '1'
+        env[b'HGPLAIN'] = b'1'
+
         return env
 
     def is_mercurial_modern(self):
         hg = self.which('hg')
         if not hg:
             print(NO_MERCURIAL)
             return False, False, None
 
--- a/python/mozboot/mozboot/windows.py
+++ b/python/mozboot/mozboot/windows.py
@@ -37,21 +37,24 @@ class WindowsBootstrapper(BaseBootstrapp
     ]
 
     def __init__(self, **kwargs):
         if 'MOZ_WINDOWS_BOOTSTRAP' not in os.environ or os.environ['MOZ_WINDOWS_BOOTSTRAP'] != '1':
             raise NotImplementedError('Bootstrap support for Windows is under development. For now, use MozillaBuild '
                                       'to set up a build environment on Windows. If you are testing Windows Bootstrap support, '
                                       'try `export MOZ_WINDOWS_BOOTSTRAP=1`')
         BaseBootstrapper.__init__(self, **kwargs)
-        if not self.which('pacman.exe'):
+        if not self.which('pacman'):
             raise NotImplementedError('The Windows bootstrapper only works with msys2 with pacman. Get msys2 at '
                                       'http://msys2.github.io/')
         print 'Using an experimental bootstrapper for Windows.'
 
+    def which(self, name):
+        return BaseBootstrapper.which(self, name + '.exe')
+
     def install_system_packages(self):
         self.pacman_install(*self.SYSTEM_PACKAGES)
 
     def upgrade_mercurial(self, current):
         self.pip_install('mercurial')
 
     def install_browser_packages(self):
         self.pacman_install(*self.BROWSER_PACKAGES)