From 94e33cd7e34f961c389b554d73e2edac8a3980ca Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 8 Apr 2018 18:42:47 +0100 Subject: [PATCH] Switch to a more user-friendly warning style --- cibuildwheel/__main__.py | 20 ++++++++++++++++++++ cibuildwheel/util.py | 4 ---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 81fb2612..52e1b0ac 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -167,7 +167,27 @@ def print_preamble(platform, build_options): for option, value in build_options.items(): print(' %s: %r' % (option, value)) + warnings = detect_warnings(platform, build_options) + if warnings: + print('\nWarnings:') + for warning in warnings: + print(' ' + warning) + print('\nHere we go!\n') +def detect_warnings(platform, build_options): + warnings = [] + + # warn about deprecated {python} and {pip} + for option_name in ['test_command', 'before_build']: + option_value = build_options.get(option_name) + + if option_value: + if '{python}' in option_value or '{pip}' in option_value: + warnings.append(option_name + ": '{python}' and '{pip}' are no longer needed, and will be removed in a future release. Simply use 'python' or 'pip' instead.") + + return warnings + + if __name__ == '__main__': main() diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index 7cc075a2..fc74ef65 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -9,10 +9,6 @@ def prepare_command(command, project): For example, used in the test_command option, to specify the path to the tests directory. ''' - if '{python}' in command or '{pip}' in command: - warnings.warn("'{python}' and '{pip}' are no longer needed, and have been deprecated. Simply use 'python' or 'pip' instead.", - DeprecationWarning) - return command.format(python='python', pip='pip', project=project)