Bug 847508 - Allow mach_bootstrap to specify a separate mozilla dir, for comm-central builds [r=gps]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 07 Mar 2013 13:19:27 -0800
changeset 124110 0e7639e3bdfbe56b5e788f234cafb3c5074954cc
parent 124109 71395a927025084394dafbd2b6d084c32ea76eb4
child 124161 f505903671a7a940a50c592ea7b3be563777ad18
child 124183 4ada9533c6d5fc52aa33cda967bcb0ec486ab375
push id24407
push usermbrubeck@mozilla.com
push dateThu, 07 Mar 2013 21:25:59 +0000
treeherdermozilla-central@0e7639e3bdfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs847508
milestone22.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 847508 - Allow mach_bootstrap to specify a separate mozilla dir, for comm-central builds [r=gps] DONTBUILD (not part of the build)
build/mach_bootstrap.py
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -1,9 +1,8 @@
-#!/usr/bin/env python
 # 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/.
 
 from __future__ import print_function, unicode_literals
 
 import os
 import platform
@@ -36,27 +35,30 @@ MACH_MODULES = [
     'python/mozbuild/mozbuild/config.py',
     'python/mozbuild/mozbuild/mach_commands.py',
     'python/mozbuild/mozbuild/frontend/mach_commands.py',
     'testing/mochitest/mach_commands.py',
     'testing/xpcshell/mach_commands.py',
     'tools/mach_commands.py',
 ]
 
-def bootstrap(topsrcdir):
+def bootstrap(topsrcdir, mozilla_dir=None):
+    if mozilla_dir is None:
+        mozilla_dir = topsrcdir
+
     # Ensure we are running Python 2.7+. We put this check here so we generate a
     # user-friendly error message rather than a cryptic stack trace on module
     # import.
     if sys.version_info[0] != 2 or sys.version_info[1] < 7:
         print('Python 2.7 or above (but not Python 3) is required to run mach.')
         print('You are running Python', platform.python_version())
         sys.exit(1)
 
     try:
         import mach.main
     except ImportError:
-        sys.path[0:0] = [os.path.join(topsrcdir, path) for path in SEARCH_PATHS]
+        sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
         import mach.main
 
     mach = mach.main.Mach(topsrcdir)
     for path in MACH_MODULES:
-        mach.load_commands_from_file(os.path.join(topsrcdir, path))
+        mach.load_commands_from_file(os.path.join(mozilla_dir, path))
     return mach