diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-25 12:24:50 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-25 17:04:22 +0200 |
commit | c26a7548f43d7fad96c4c7d83aeb7150bcb9e48b (patch) | |
tree | 4399719faa5279fb8a5ff484ed623f4f36cb63ff /giscanner/scannermain.py | |
parent | 96df6e243642ee8fe435f6d4108295d20d659b20 (diff) | |
download | gobject-introspection-c26a7548f43d7fad96c4c7d83aeb7150bcb9e48b.tar.gz |
transformer: don't shell out for filter commands and make the tests work on Windows
Instead of passing the filter commands to the shell, split them with the shlex module.
This gives us more control and a more similar behaviour on unix/win32 systems.
I could only find two users in Debian which just call python with some script, so
this seems safe to me.
Adjust the tests accordingly and use the running python executable to test the
functionality as we can be sure that's available on all platforms. Also add a
new test for the symbol filter commadn which wasn't tested before.
Diffstat (limited to 'giscanner/scannermain.py')
-rwxr-xr-x | giscanner/scannermain.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index acb2eba0..2f1d9095 100755 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -34,6 +34,7 @@ import subprocess import sys import tempfile import platform +import shlex import giscanner from giscanner import message @@ -382,10 +383,12 @@ see --identifier-prefix and --symbol-prefix.""") def create_transformer(namespace, options): + identifier_filter_cmd = shlex.split(options.identifier_filter_cmd) + symbol_filter_cmd = shlex.split(options.symbol_filter_cmd) transformer = Transformer(namespace, accept_unprefixed=options.accept_unprefixed, - identifier_filter_cmd=options.identifier_filter_cmd, - symbol_filter_cmd=options.symbol_filter_cmd) + identifier_filter_cmd=identifier_filter_cmd, + symbol_filter_cmd=symbol_filter_cmd) transformer.set_include_paths(options.include_paths) if options.passthrough_gir or options.reparse_validate_gir: transformer.disable_cache() |