Switch to a more user-friendly warning style

This commit is contained in:
Joe Rickerby
2018-04-08 18:42:47 +01:00
parent c9c54602ed
commit 94e33cd7e3
2 changed files with 20 additions and 4 deletions
+20
View File
@@ -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()
-4
View File
@@ -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)