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/.
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
))
13 raise Exception("Can't find config.status")
16 path
= os
.path
.join(path
, 'config.status')
17 config
= imp
.load_module('_buildconfig', open(path
), path
, ('', 'r', imp
.PY_SOURCE
))
19 # Copy values from the config.status namespace into this module namespace.
20 # This effectively imports topsrcdir, topobjdir, defines, substs, files,
21 # headers and non_global_defines
22 for var
in config
.__all
__:
23 value
= getattr(config
, var
)
24 if isinstance(value
, list) and value
and isinstance(value
[0], tuple):
26 setattr(sys
.modules
[__name__
], var
, value
)
28 for var
in os
.environ
:
29 if var
!= 'SHELL' and var
in substs
:
30 substs
[var
] = os
.environ
[var
]