mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Fix for keywords_with_side_effects() (compatibility with pip metadata discovery)
Fixes a bug in 9e34c14b344f49d0721edc79d14ea5fc9c067d07 as described in https://github.com/pyca/cryptography/pull/1257#issuecomment-48855243
This commit is contained in:
parent
c9861f9bd4
commit
6c1e9ef571
1 changed files with 26 additions and 3 deletions
29
setup.py
29
setup.py
|
|
@ -177,6 +177,7 @@ def keywords_with_side_effects(argv):
|
|||
'--contact',
|
||||
'--contact-email',
|
||||
'--description',
|
||||
'--egg-base',
|
||||
'--fullname',
|
||||
'--help-commands',
|
||||
'--keywords',
|
||||
|
|
@ -198,9 +199,31 @@ def keywords_with_side_effects(argv):
|
|||
'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:]):
|
||||
def is_short_option(argument):
|
||||
"""Check whether a command line argument is a short option."""
|
||||
return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-'
|
||||
def expand_short_options(argument):
|
||||
"""Expand combined short options into canonical short options."""
|
||||
return ('-' + char for char in argument[1:])
|
||||
def argument_without_setup_requirements(argv, i):
|
||||
"""Check whether a command line argument needs setup requirements."""
|
||||
if argv[i] in no_setup_requires_arguments:
|
||||
# Simple case: An argument which is either an option or a command
|
||||
# which doesn't need setup requirements.
|
||||
return True
|
||||
elif is_short_option(argv[i]) and all(option in
|
||||
no_setup_requires_arguments for option in
|
||||
expand_short_options(argv[i])):
|
||||
# Not so simple case: Combined short options none of which need
|
||||
# setup requirements.
|
||||
return True
|
||||
elif argv[i - 1 : i] == ['--egg-base']:
|
||||
# Tricky case: --egg-info takes an argument which should not make
|
||||
# us use setup_requires (defeating the purpose of this code).
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
if all(argument_without_setup_requirements(argv, i) for i in range(1, len(argv))):
|
||||
return {
|
||||
"cmdclass": {
|
||||
"build": DummyCFFIBuild,
|
||||
|
|
|
|||
Loading…
Reference in a new issue