1
0
Fork 0

Provide users with replacements for deprecated/invalid functionality where applicable (#17604)

This commit is contained in:
Ryan 2022-08-06 22:37:40 +10:00 committed by GitHub
parent 0ff8c4f6fd
commit 37345e2ace
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 7 deletions

View file

@ -463,10 +463,17 @@ def _extract_config_h(info_data, config_c):
key_type = info_dict.get('value_type', 'raw')
try:
replace_with = info_dict.get('replace_with')
if config_key in config_c and info_dict.get('invalid', False):
_log_error(info_data, '%s in config.h is no longer a valid option' % config_key)
if replace_with:
_log_error(info_data, '%s in config.h is no longer a valid option and should be replaced with %s' % (config_key, replace_with))
else:
_log_error(info_data, '%s in config.h is no longer a valid option and should be removed' % config_key)
elif config_key in config_c and info_dict.get('deprecated', False):
_log_warning(info_data, '%s in config.h is deprecated and will be removed at a later date' % config_key)
if replace_with:
_log_warning(info_data, '%s in config.h is deprecated in favor of %s and will be removed at a later date' % (config_key, replace_with))
else:
_log_warning(info_data, '%s in config.h is deprecated and will be removed at a later date' % config_key)
if config_key in config_c and info_dict.get('to_json', True):
if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True):
@ -527,10 +534,17 @@ def _extract_rules_mk(info_data, rules):
key_type = info_dict.get('value_type', 'raw')
try:
replace_with = info_dict.get('replace_with')
if rules_key in rules and info_dict.get('invalid', False):
_log_error(info_data, '%s in rules.mk is no longer a valid option' % rules_key)
if replace_with:
_log_error(info_data, '%s in rules.mk is no longer a valid option and should be replaced with %s' % (rules_key, replace_with))
else:
_log_error(info_data, '%s in rules.mk is no longer a valid option and should be removed' % rules_key)
elif rules_key in rules and info_dict.get('deprecated', False):
_log_warning(info_data, '%s in rules.mk is deprecated and will be removed at a later date' % rules_key)
if replace_with:
_log_warning(info_data, '%s in rules.mk is deprecated in favor of %s and will be removed at a later date' % (rules_key, replace_with))
else:
_log_warning(info_data, '%s in rules.mk is deprecated and will be removed at a later date' % rules_key)
if rules_key in rules and info_dict.get('to_json', True):
if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True):