1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/buildconfig.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +import imp 1.9 +import os 1.10 +import sys 1.11 + 1.12 +path = os.path.dirname(__file__) 1.13 +while not os.path.exists(os.path.join(path, 'config.status')): 1.14 + parent = os.path.normpath(os.path.join(path, os.pardir)) 1.15 + if parent == path: 1.16 + raise Exception("Can't find config.status") 1.17 + path = parent 1.18 + 1.19 +path = os.path.join(path, 'config.status') 1.20 +config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE)) 1.21 + 1.22 +# Copy values from the config.status namespace into this module namespace. 1.23 +# This effectively imports topsrcdir, topobjdir, defines, substs, files, 1.24 +# headers and non_global_defines 1.25 +for var in config.__all__: 1.26 + value = getattr(config, var) 1.27 + if isinstance(value, list) and value and isinstance(value[0], tuple): 1.28 + value = dict(value) 1.29 + setattr(sys.modules[__name__], var, value) 1.30 + 1.31 +for var in os.environ: 1.32 + if var != 'SHELL' and var in substs: 1.33 + substs[var] = os.environ[var]