summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py39
-rw-r--r--test/test_misc.py14
2 files changed, 35 insertions, 18 deletions
diff --git a/setup.py b/setup.py
index 60953eed..8b7a9930 100644
--- a/setup.py
+++ b/setup.py
@@ -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()
diff --git a/test/test_misc.py b/test/test_misc.py
index 857f4cd8..44607a2d 100644
--- a/test/test_misc.py
+++ b/test/test_misc.py
@@ -33,7 +33,7 @@ class SetupPyTest(CoverageTest):
run_in_temp_dir = False
- def test_version(self):
+ def test_metadata(self):
status, output = self.run_command_status(
"python setup.py --description --version --url --author"
)
@@ -43,3 +43,15 @@ class SetupPyTest(CoverageTest):
self.assertEqual(out[1], __version__)
self.assertEqual(out[2], __url__)
self.assertIn("Ned Batchelder", out[3])
+
+ def test_more_metadata(self):
+ from setup import setup_args
+
+ classifiers = setup_args['classifiers']
+ self.assertGreater(len(classifiers), 7)
+ self.assertTrue(classifiers[-1].startswith("Development Status ::"))
+
+ long_description = setup_args['long_description'].splitlines()
+ self.assertGreater(len(long_description), 7)
+ self.assertNotEqual(long_description[0].strip(), "")
+ self.assertNotEqual(long_description[-1].strip(), "")