bug 839193 - test for corresponding bug r=bent
[gecko.git] / mach
bloba4242f097454301ed1b22fba0d4db7f4bbf5838a
1 #!/usr/bin/env python
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 from __future__ import print_function, unicode_literals
8 import os
9 import platform
10 import sys
12 # Ensure we are running Python 2.7+. We put this check here so we generate a
13 # user-friendly error message rather than a cryptic stack trace on module
14 # import.
15 if sys.version_info[0] != 2 or sys.version_info[1] < 7:
16 print('Python 2.7 or above (but not Python 3) is required to run mach.')
17 print('You are running Python', platform.python_version())
18 sys.exit(1)
20 # TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
21 SEARCH_PATHS = [
22 'python/mach',
23 'python/mozboot',
24 'python/mozbuild',
25 'build',
26 'build/pymake',
27 'python/blessings',
28 'python/psutil',
29 'python/which',
30 'other-licenses/ply',
31 'xpcom/idl-parser',
32 'testing',
33 'testing/xpcshell',
34 'testing/mozbase/mozprocess',
35 'testing/mozbase/mozfile',
36 'testing/mozbase/mozinfo',
39 # Individual files providing mach commands.
40 MACH_MODULES = [
41 'addon-sdk/mach_commands.py',
42 'layout/tools/reftest/mach_commands.py',
43 'python/mozboot/mozboot/mach_commands.py',
44 'python/mozbuild/mozbuild/config.py',
45 'python/mozbuild/mozbuild/mach_commands.py',
46 'python/mozbuild/mozbuild/frontend/mach_commands.py',
47 'testing/mochitest/mach_commands.py',
48 'testing/xpcshell/mach_commands.py',
51 our_dir = os.path.dirname(os.path.abspath(__file__))
53 try:
54 import mach.main
55 except ImportError:
56 sys.path[0:0] = [os.path.join(our_dir, path) for path in SEARCH_PATHS]
58 import mach.main
60 # All of the code is in a module because EVERYTHING IS A LIBRARY.
61 mach = mach.main.Mach(our_dir)
63 for path in MACH_MODULES:
64 mach.load_commands_from_file(os.path.join(our_dir, path))
66 sys.exit(mach.run(sys.argv[1:]))