aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2014-07-12 03:14:55 +0200
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-29 11:44:31 -0500
commite9144566b6fe539256487687dfa5e863f7bdee96 (patch)
tree436c704e7f99d559a79fc90979f78e8d812b91e5
parentdcce080527d6498eed0a453e73e4e9032b4a87d4 (diff)
downloadcryptography-e9144566b6fe539256487687dfa5e863f7bdee96.tar.gz
cryptography-e9144566b6fe539256487687dfa5e863f7bdee96.tar.bz2
cryptography-e9144566b6fe539256487687dfa5e863f7bdee96.zip
Bullet proof (?) detection of arguments that don't need setup_requires
-rw-r--r--setup.py56
1 files changed, 45 insertions, 11 deletions
diff --git a/setup.py b/setup.py
index ad3ffcfc..94a18ea8 100644
--- a/setup.py
+++ b/setup.py
@@ -150,23 +150,57 @@ def keywords_with_side_effects(argv):
This setup.py script uses the setuptools 'setup_requires' feature because
this is required by the cffi package to compile extension modules. The
purpose of ``keywords_with_side_effects()`` is to avoid triggering the cffi
- build process as a result of any of the following ``setup.py`` invocations:
+ build process as a result of setup.py invocations that don't need the cffi
+ module to be built (setup.py serves the dual purpose of exposing package
+ metadata).
- - ``python setup.py --help-commands``
- - ``python setup.py --help``
- - ``python setup.py --version``
- - ``python setup.py clean``
- - ``python setup.py egg_info``
+ All of the options listed by ``python setup.py --help`` that print
+ information should be recognized here. The commands ``clean``,
+ ``egg_info``, ``register``, ``sdist`` and ``upload`` are also recognized.
+ Any combination of these options and commands is also supported.
- This function is based on the `setup.py script`_ of SciPy (see also the
- discussion in `pip issue #25`_).
+ This function was originally based on the `setup.py script`_ of SciPy (see
+ also the discussion in `pip issue #25`_).
.. _pip issue #25: https://github.com/pypa/pip/issues/25
.. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py
"""
- if len(argv) >= 2 and ('--help' in argv[1:] or
- argv[1] in ('--help-commands', '--version',
- 'clean', 'egg_info')):
+ no_setup_requires_arguments = (
+ '-h', '--help',
+ '-n', '--dry-run',
+ '-q', '--quiet',
+ '-v', '--verbose',
+ '-V', '--version',
+ '--author',
+ '--author-email',
+ '--classifiers',
+ '--contact',
+ '--contact-email',
+ '--description',
+ '--fullname',
+ '--help-commands',
+ '--keywords',
+ '--licence',
+ '--license',
+ '--long-description',
+ '--maintainer',
+ '--maintainer-email',
+ '--name',
+ '--no-user-cfg',
+ '--obsoletes',
+ '--platforms',
+ '--provides',
+ '--requires',
+ '--url',
+ 'clean',
+ 'egg_info',
+ 'register',
+ 'sdist',
+ 'upload',
+ )
+ if all((arg in no_setup_requires_arguments) or
+ all(('-' + char) in no_setup_requires_arguments for char in arg[1:])
+ for arg in argv[1:]):
return {
"cmdclass": {
"build": DummyCFFIBuild,