build/buildconfig.py
author Mike Hommey <mh+mozilla@glandium.org>
Tue, 07 Jun 2016 08:25:10 +0900
changeset 301950 a2e4369f86dcf620b453de3da6525a87ea1808fc
parent 300066 b6db2e11244e06e2563e7444709060cd9ea90e9f
permissions -rw-r--r--
Bug 1278415 - Make the buildconfig module use MozbuildObject.from_environment. r=gps The buildconfig module predates MozbuildObject.from_environment, and it's about time to start factoring things out such that we only have one way to get config.status data. This is step 1: making the buildconfig module use MozbuildObject.from_environment. Eventually, we'll want to remove the buildconfig module uses everywhere.

# 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 os
import sys
from mozbuild.base import MozbuildObject

config = MozbuildObject.from_environment()

for var in ('topsrcdir', 'topobjdir', 'defines', 'non_global_defines',
            'substs'):
    value = getattr(config, var)
    setattr(sys.modules[__name__], var, value)

substs = dict(substs)

for var in os.environ:
    if var != 'SHELL' and var in substs:
        substs[var] = os.environ[var]