build/buildconfig.py
author Justin Lebar <justin.lebar@gmail.com>
Tue, 11 Dec 2012 18:26:43 -0500
changeset 122875 6733372df4c10d02ac3f0cd6fc9aaccc9021fa02
parent 114480 2d77b2fff1a16ddd95aa21ec4b0bbac56316422a
child 130012 6b280e1554845df3eff6a6ef1f885ab6a64f4489
permissions -rw-r--r--
Bug 820401 - Default DMD to sample-below=4093. r=njn, a=jlebar Also print out the sample size, since it's no longer explicit in the $DMD envvar.

# 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/.

import imp
import os
import sys

path = os.path.dirname(__file__)
while not os.path.exists(os.path.join(path, 'config.status')):
    parent = os.path.normpath(os.path.join(path, os.pardir))
    if parent == path:
        raise Exception("Can't find config.status")
    path = parent

path = os.path.join(path, 'config.status')
config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE))

for var in os.environ:
    if var in config.substs:
        config.substs[var] = os.environ[var]

for var in config.__all__:
    value = getattr(config, var)
    if isinstance(value, list) and isinstance(value[0], tuple):
        value = dict(value)
    setattr(sys.modules[__name__], var, value)