Bug 826008: Fix type tests for constraints objects r=smaug
[gecko.git] / build / buildconfig.py
blob679b03390c53d91f0e2992b951a3a6329dcc3622
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import imp
6 import os
7 import sys
9 path = os.path.dirname(__file__)
10 while not os.path.exists(os.path.join(path, 'config.status')):
11 parent = os.path.normpath(os.path.join(path, os.pardir))
12 if parent == path:
13 raise Exception("Can't find config.status")
14 path = parent
16 path = os.path.join(path, 'config.status')
17 config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE))
19 for var in os.environ:
20 if var in config.substs:
21 config.substs[var] = os.environ[var]
23 for var in config.__all__:
24 value = getattr(config, var)
25 if isinstance(value, list) and isinstance(value[0], tuple):
26 value = dict(value)
27 setattr(sys.modules[__name__], var, value)