Bug 1275437 - Added placeholder for Windows bootstrapper. r?gps draft
authorNathan Hakkakzadeh <nhakkakzadeh@mozilla.com>
Wed, 25 May 2016 16:32:09 -0700
changeset 371481 f54f521b0709843074f06129242d777bd8b377dd
parent 370474 5511d54a3f172c1d68f98cc55dce4de1d0ba1b51
child 371482 c1511267eeb5da93d7fbafff4cf153b2ff0cb645
push id19337
push userbmo:nhakkakzadeh@mozilla.com
push dateThu, 26 May 2016 18:26:24 +0000
reviewersgps
bugs1275437
milestone49.0a1
Bug 1275437 - Added placeholder for Windows bootstrapper. r?gps Created a WindowsBootstrapper class that raises a NotImplementedError when initialized. As WindowsBootstrapper is implemented, set $MOZ_WINDOWS_BOOTSTRAP to '1' in your environment to test it. Bootstrapper now detects if the system is being run on Windows, and if it is dispatches to the WindowsBootstrapper. MozReview-Commit-ID: 3x6PDPuLtzs
python/mozboot/mozboot/bootstrap.py
python/mozboot/mozboot/windows.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -13,16 +13,17 @@ import os.path
 # list in bin/bootstrap.py!
 from mozboot.centosfedora import CentOSFedoraBootstrapper
 from mozboot.debian import DebianBootstrapper
 from mozboot.freebsd import FreeBSDBootstrapper
 from mozboot.gentoo import GentooBootstrapper
 from mozboot.osx import OSXBootstrapper
 from mozboot.openbsd import OpenBSDBootstrapper
 from mozboot.archlinux import ArchlinuxBootstrapper
+from mozboot.windows import WindowsBootstrapper
 
 APPLICATION_CHOICE = '''
 Please choose the version of Firefox you want to build:
 %s
 
 Note: (For Firefox for Android)
 
 The Firefox for Android front-end is built using Java, the Android
@@ -134,16 +135,19 @@ class Bootstrapper(object):
             args['version'] = platform.uname()[2]
 
         elif sys.platform.startswith('dragonfly') or \
                 sys.platform.startswith('freebsd'):
             cls = FreeBSDBootstrapper
             args['version'] = platform.release()
             args['flavor'] = platform.system()
 
+        elif sys.platform.startswith('win32') or sys.platform.startswith('msys'):
+            cls = WindowsBootstrapper
+
         if cls is None:
             raise NotImplementedError('Bootstrap support is not yet available '
                                       'for your OS.')
 
         self.instance = cls(**args)
 
     def bootstrap(self):
         if self.choice is None:
new file mode 100644
--- /dev/null
+++ b/python/mozboot/mozboot/windows.py
@@ -0,0 +1,18 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+
+from mozboot.base import BaseBootstrapper
+
+class WindowsBootstrapper(BaseBootstrapper):
+    '''Bootstrapper for msys2 based environments for building in Windows.'''
+    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)
+        raise NotImplementedError('Bootstrap support is not yet available for Windows. '
+                                  'For now, use MozillaBuild to set up a build environment on Windows.')