Use consistent formatting for deprecations

Add a warn() function for use in consistently displaying warning
messages, for use in things like deprecation warnings. Also make the
one current deprecation warning use this and be more explicit about
future removal.

Change-Id: I423524b30233ae45fbc04133566acf7a23828036
This commit is contained in:
Jeremy Stanley 2016-06-07 14:44:51 +00:00
parent 47cbee9687
commit 6eee79466a

View File

@ -110,6 +110,10 @@ def printwrap(unwrapped):
print('\n'.join(textwrap.wrap(unwrapped)))
def warn(warning):
printwrap("WARNING: %s")
def parse_review_number(review):
parts = review.split(',')
if len(parts) < 2:
@ -280,8 +284,9 @@ class Config(object):
if os.path.exists(filename):
if filename != config_file:
msg = ("Using global/system git-review config files (%s) "
"is deprecated")
print(msg % filename)
"is deprecated and will be removed in a future "
"release")
warn(msg % filename)
self.config.update(load_config_file(filename))
def __getitem__(self, key):