summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-09-01 21:07:10 -0300
committerJohan Dahlin <johan@gnome.org>2010-09-01 21:07:10 -0300
commitf1c1b9b1641bf9ea2844202cb5237c305af42ac9 (patch)
treecd097d2b8cd4f01314b12e4d3289cc33d1e0774f /giscanner
parentdfff733b154abf1e85d447d2da389b34396fe005 (diff)
downloadgobject-introspection-f1c1b9b1641bf9ea2844202cb5237c305af42ac9.tar.gz
[scannermain] Use return instead of sys.exit()
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/scannermain.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 8db1d2bf..c0f280c7 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -205,7 +205,7 @@ def process_packages(parser, options, packages):
if output is None:
# the error output should have already appeared on our stderr,
# so we just exit
- sys.exit(1)
+ return 1
# 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']
@@ -220,7 +220,7 @@ def process_packages(parser, options, packages):
output = subprocess.Popen(args,
stdout=subprocess.PIPE).communicate()[0]
if output is None:
- sys.exit(1)
+ return 1
filtered_output = list(process_options(output, options_whitelist))
pkg_options, unused = parser.parse_args(filtered_output)
options.library_paths.extend(pkg_options.library_paths)
@@ -296,12 +296,14 @@ def scanner_main(args):
include_obj = Include.from_string(include)
except:
sys.stderr.write("Malformed include %r\n" % (include, ))
- sys.exit(1)
+ return 1
transformer.register_include(include_obj)
packages = set(options.packages)
packages.update(transformer.get_pkgconfig_packages())
- process_packages(parser, options, packages)
+ exit_code = process_packages(parser, options, packages)
+ if exit_code:
+ return exit_code
# Run the preprocessor, tokenize and construct simple
# objects representing the raw C symbols
@@ -347,8 +349,7 @@ def scanner_main(args):
if options.warn_fatal and transformer.did_warn():
transformer.log_warning("warnings configured as fatal", fatal=True)
- # Redundant sys.exit here, just in case
- sys.exit(1)
+ return 1
# Write out AST
if options.packages_export:
@@ -378,7 +379,7 @@ def scanner_main(args):
except OSError, e:
if e.errno == errno.EPERM:
os.unlink(main_f.name)
- return
+ return 0
raise
else:
sys.stdout.write(data)