diff options
author | Colin Walters <walters@verbum.org> | 2008-08-25 00:32:30 +0000 |
---|---|---|
committer | Colin Walters <walters@src.gnome.org> | 2008-08-25 00:32:30 +0000 |
commit | e5ab6f31f07cf3a3b8a39c389cd0029aa9ad25ed (patch) | |
tree | 0b19f8138a97a1608f4807afb21aac5224a9bc3f /tools/g-ir-scanner | |
parent | ffc705a4bb34ccdde1e0551b5025ac390f2fe22b (diff) | |
download | gobject-introspection-e5ab6f31f07cf3a3b8a39c389cd0029aa9ad25ed.tar.gz |
Filter out unknown options from pkg-config files.
2008-08-24 Colin Walters <walters@verbum.org>
* tools/g-ir-scanner: Filter out unknown options from
pkg-config files.
svn path=/trunk/; revision=488
Diffstat (limited to 'tools/g-ir-scanner')
-rwxr-xr-x | tools/g-ir-scanner | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner index 48c889e8..c5c8f37e 100755 --- a/tools/g-ir-scanner +++ b/tools/g-ir-scanner @@ -137,14 +137,26 @@ def main(args): for package in options.packages: output = subprocess.Popen(['pkg-config', '--cflags', package], stdout=subprocess.PIPE).communicate()[0] - pkg_options, unused = parser.parse_args(output.split()) + # Some pkg-config files on Windows have options we don't understand, + # so we explicitly filter to only the ones we need. + options_whitelist = ['-I', '-D', '-U', '-l', '-L'] + def filter_option(opt): + for optstart in options_whitelist: + if opt.startswith(optstart): + return True + return False + output = output.split() + filtered_output = filter(filter_option, output) + pkg_options, unused = parser.parse_args(filtered_output) options.cpp_includes.extend(pkg_options.cpp_includes) options.cpp_defines.extend(pkg_options.cpp_defines) options.cpp_undefines.extend(pkg_options.cpp_undefines) output = subprocess.Popen(['pkg-config', '--libs-only-L', package], stdout=subprocess.PIPE).communicate()[0] - pkg_options, unused = parser.parse_args(output.split()) + output = output.split() + filtered_output = filter(filter_option, output) + pkg_options, unused = parser.parse_args(filtered_output) options.library_paths.extend(pkg_options.library_paths) filenames = [] |