Skip to content
Snippets Groups Projects
Commit c867f67a authored by Christoph Groth's avatar Christoph Groth
Browse files

setup.py: consistently use sys.exit

parent d36b3aa3
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ def configure_extensions(exts, aliases=(), build_summary=None): ...@@ -66,7 +66,7 @@ def configure_extensions(exts, aliases=(), build_summary=None):
if l != config_file_option or not config_file: if l != config_file_option or not config_file:
print('error: Expecting {}=PATH'.format(config_file_option), print('error: Expecting {}=PATH'.format(config_file_option),
file=sys.stderr) file=sys.stderr)
exit(1) sys.exit(1)
sys.argv.pop(i) sys.argv.pop(i)
break break
else: else:
...@@ -88,7 +88,7 @@ def configure_extensions(exts, aliases=(), build_summary=None): ...@@ -88,7 +88,7 @@ def configure_extensions(exts, aliases=(), build_summary=None):
if long in configs: if long in configs:
print('Error: both {} and {} sections present in {}.'.format( print('Error: both {} and {} sections present in {}.'.format(
short, long, config_file)) short, long, config_file))
exit(1) sys.exit(1)
configs[long] = configs[short] configs[long] = configs[short]
del configs[short] del configs[short]
...@@ -126,7 +126,7 @@ def configure_extensions(exts, aliases=(), build_summary=None): ...@@ -126,7 +126,7 @@ def configure_extensions(exts, aliases=(), build_summary=None):
if unknown_sections: if unknown_sections:
print('Error: Unknown sections in file {}: {}'.format( print('Error: Unknown sections in file {}: {}'.format(
config_file, ', '.join(unknown_sections))) config_file, ', '.join(unknown_sections)))
exit(1) sys.exit(1)
return exts return exts
...@@ -314,7 +314,7 @@ class sdist(sdist_orig): ...@@ -314,7 +314,7 @@ class sdist(sdist_orig):
print("Error:", manifest_in_file, print("Error:", manifest_in_file,
"file is missing and Git is not available" "file is missing and Git is not available"
" to regenerate it.", file=sys.stderr) " to regenerate it.", file=sys.stderr)
exit(1) sys.exit(1)
else: else:
with open(manifest, 'w') as f: with open(manifest, 'w') as f:
for name in names: for name in names:
...@@ -356,7 +356,7 @@ class test(test_orig): ...@@ -356,7 +356,7 @@ class test(test_orig):
except: except:
print('The Python package "pytest" is required to run tests.', print('The Python package "pytest" is required to run tests.',
file=sys.stderr) file=sys.stderr)
exit(1) sys.exit(1)
errno = pytest.main(shlex.split(self.pytest_args)) errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno) sys.exit(errno)
...@@ -475,7 +475,7 @@ def maybe_cythonize(exts): ...@@ -475,7 +475,7 @@ def maybe_cythonize(exts):
ext = '.cpp' ext = '.cpp'
else: else:
print('Unknown language: {}'.format(language), file=sys.stderr) print('Unknown language: {}'.format(language), file=sys.stderr)
exit(1) sys.exit(1)
pyx_files = [] pyx_files = []
cythonized_files = [] cythonized_files = []
...@@ -496,7 +496,7 @@ def maybe_cythonize(exts): ...@@ -496,7 +496,7 @@ def maybe_cythonize(exts):
msg = "Cython-generated file {} is missing." msg = "Cython-generated file {} is missing."
print(banner(" Error "), msg.format(f), "", print(banner(" Error "), msg.format(f), "",
cython_help, banner(), sep="\n", file=sys.stderr) cython_help, banner(), sep="\n", file=sys.stderr)
exit(1) sys.exit(1)
for f in pyx_files + kwargs.get('depends', []): for f in pyx_files + kwargs.get('depends', []):
if f == config_file: if f == config_file:
...@@ -525,7 +525,7 @@ def maybe_cythonize(exts): ...@@ -525,7 +525,7 @@ def maybe_cythonize(exts):
print(banner(" Error " if error else " Caution "), msg, "", print(banner(" Error " if error else " Caution "), msg, "",
cython_help, banner(), sep="\n", file=sys.stderr) cython_help, banner(), sep="\n", file=sys.stderr)
if error: if error:
exit(1) sys.exit(1)
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment