diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-12 11:34:19 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-12 11:34:19 -0500 |
commit | d06463e80c41ef52153e8d500487aa2b07733dda (patch) | |
tree | c3f8d4dfe0099c92a300383fddad091994128b19 /setup.py | |
parent | eb6d290b8a4b089cd4d71364d38cf702bcb9289b (diff) | |
download | python-coveragepy-git-d06463e80c41ef52153e8d500487aa2b07733dda.tar.gz |
Once you start unit testing setup.py, where do you stop??
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -129,20 +129,25 @@ if sys.version_info >= (3, 0): use_2to3=False, )) -# For a variety of reasons, it might not be possible to install the C -# extension. Try it with, and if it fails, try it without. -try: - setup(**setup_args) -except: # pylint: disable=W0702 - # When setup() can't compile, it tries to exit. We'll catch SystemExit - # here :-(, and try again. - if 'install' not in sys.argv or 'ext_modules' not in setup_args: - # We weren't trying to install an extension, so forget it. - raise - msg = "Couldn't install with extension module, trying without it..." - exc = sys.exc_info()[1] - exc_msg = "%s: %s" % (exc.__class__.__name__, exc) - print("**\n** %s\n** %s\n**" % (msg, exc_msg)) - - del setup_args['ext_modules'] - setup(**setup_args) +def main(): + """Actually invoke setup() with the arguments we built above.""" + # For a variety of reasons, it might not be possible to install the C + # extension. Try it with, and if it fails, try it without. + try: + setup(**setup_args) + except: # pylint: disable=W0702 + # When setup() can't compile, it tries to exit. We'll catch SystemExit + # here :-(, and try again. + if 'install' not in sys.argv or 'ext_modules' not in setup_args: + # We weren't trying to install an extension, so forget it. + raise + msg = "Couldn't install with extension module, trying without it..." + exc = sys.exc_info()[1] + exc_msg = "%s: %s" % (exc.__class__.__name__, exc) + print("**\n** %s\n** %s\n**" % (msg, exc_msg)) + + del setup_args['ext_modules'] + setup(**setup_args) + +if __name__ == '__main__': + main() |