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
11 old_bytecode
= sys
.dont_write_bytecode
12 sys
.dont_write_bytecode
= True
14 path
= os
.path
.join(os
.path
.dirname(__file__
), 'mach')
16 if not os
.path
.exists(path
):
17 path
= os
.path
.join(os
.path
.dirname(__file__
), 'config.status')
18 config
= imp
.load_module('_buildconfig', open(path
), path
, ('', 'r', imp
.PY_SOURCE
))
19 path
= os
.path
.join(config
.topsrcdir
, 'mach')
20 mach_module
= imp
.load_module('_mach', open(path
), path
, ('', 'r', imp
.PY_SOURCE
))
22 sys
.dont_write_bytecode
= old_bytecode
24 def FlagsForFile(filename
):
25 mach
= mach_module
.get_mach()
28 mach
.run(['compileflags', filename
], stdout
=out
, stderr
=out
)
30 flag_list
= shlex
.split(out
.getvalue())
32 # This flag is added by Fennec for android build and causes ycmd to fail to parse the file.
33 # Removing this flag is a workaround until ycmd starts to handle this flag properly.
34 # https://github.com/Valloric/YouCompleteMe/issues/1490
35 final_flags
= [x
for x
in flag_list
if not x
.startswith('-march=armv')]