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/.
7 from StringIO
import StringIO
10 path
= os
.path
.join(os
.path
.dirname(__file__
), 'mach')
12 if not os
.path
.exists(path
):
13 path
= os
.path
.join(os
.path
.dirname(__file__
), 'config.status')
14 config
= imp
.load_module('_buildconfig', open(path
), path
, ('', 'r', imp
.PY_SOURCE
))
15 path
= os
.path
.join(config
.topsrcdir
, 'mach')
16 mach_module
= imp
.load_module('_mach', open(path
), path
, ('', 'r', imp
.PY_SOURCE
))
18 def FlagsForFile(filename
):
19 mach
= mach_module
.get_mach()
22 mach
.run(['compileflags', filename
], stdout
=out
, stderr
=out
)
25 'flags': shlex
.split(out
.getvalue()),