build/mach_bootstrap.py
author Ian Neal <iann_cvs@blueyonder.co.uk>
Sun, 24 Nov 2019 14:23:24 +0100
changeset 32378 c12e2470fc25712059d8271e4f0b8175e4e67c9e
parent 28491 f4f277cc17496900064876b2564861ae9d3ab293
permissions -rw-r--r--
Bug 1597554 - Port |Bug 537378 - "search messages" (Ctrl+Shift+F) should be enabled in the 3pane - doesn't open if no folder or account selected/focused in folder pane.|. r=frg a=frg CLOSED TREE

# 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 unicode_literals

import os, sys

def bootstrap(topsrcdir, mozilla_dir=None):
    if mozilla_dir is None:
        mozilla_dir = os.path.join(topsrcdir, 'mozilla')

    if not os.path.exists(mozilla_dir):
        # If we can't find `mozilla` as a subdirectory of the `comm` checkout,
        # assume that we are a subdirectory of a mozilla checkout. If we return
        # `None` here, the `mach` entrypoint will keep searching for a build
        # directory.  Since the entry point imports this into `sys.modules`,
        # clean it up, since we aren't the `mach_bootstrap` that `mach` is
        # looking for.
        del sys.modules[__name__]
        return None

    sys.path[0:0] = [mozilla_dir]
    import build.mach_bootstrap
    return build.mach_bootstrap.bootstrap(topsrcdir, mozilla_dir)