Commit e6a62339 authored by Gavin Mak's avatar Gavin Mak Committed by LUCI CQ

[depot_tools] Use logging.warning

logging.warn is deprecated and should be replaced with logging.warning.

Bug:1097402
Change-Id: I55ce007bec47608eeafcf3cd9ac2b90f60073115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575621Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
parent 18f45d28
......@@ -360,10 +360,11 @@ class Mirror(object):
for fetchspec in config_fetchspecs.splitlines():
self.fetch_specs.add(self.parse_fetch_spec(fetchspec))
except subprocess.CalledProcessError:
logging.warn('Tried and failed to preserve remote.origin.fetch from the '
'existing cache directory. You may need to manually edit '
'%s and "git cache fetch" again.'
% os.path.join(self.mirror_path, 'config'))
logging.warning(
'Tried and failed to preserve remote.origin.fetch from the '
'existing cache directory. You may need to manually edit '
'%s and "git cache fetch" again.' %
os.path.join(self.mirror_path, 'config'))
def _ensure_bootstrapped(
self, depth, bootstrap, reset_fetch_config, force=False):
......@@ -381,7 +382,7 @@ class Mirror(object):
if not should_bootstrap:
if depth and os.path.exists(os.path.join(self.mirror_path, 'shallow')):
logging.warn(
logging.warning(
'Shallow fetch requested, but repo cache already exists.')
return
......@@ -408,10 +409,10 @@ class Mirror(object):
self.RunGit(['init', '--bare'], cwd=self.mirror_path)
else:
# Bootstrap failed, previous cache exists; warn and continue.
logging.warn(
logging.warning(
'Git cache has a lot of pack files (%d). Tried to re-bootstrap '
'but failed. Continuing with non-optimized repository.'
% len(pack_files))
'but failed. Continuing with non-optimized repository.' %
len(pack_files))
def _fetch(self,
rundir,
......@@ -444,7 +445,7 @@ class Mirror(object):
except subprocess.CalledProcessError:
if spec == '+refs/heads/*:refs/heads/*':
raise ClobberNeeded() # Corrupted cache.
logging.warn('Fetch of %s failed' % spec)
logging.warning('Fetch of %s failed' % spec)
def populate(self,
depth=None,
......@@ -565,9 +566,9 @@ class Mirror(object):
f = os.path.join(pack_dir, f)
try:
os.remove(f)
logging.warn('Deleted stale temporary pack file %s' % f)
logging.warning('Deleted stale temporary pack file %s' % f)
except OSError:
logging.warn('Unable to delete temporary pack file %s' % f)
logging.warning('Unable to delete temporary pack file %s' % f)
@subcommand.usage('[url of repo to check for caching]')
......@@ -772,7 +773,7 @@ class OptionParser(optparse.OptionParser):
if global_cache_dir and (
os.path.abspath(options.cache_dir) !=
os.path.abspath(global_cache_dir)):
logging.warn('Overriding globally-configured cache directory.')
logging.warning('Overriding globally-configured cache directory.')
Mirror.SetCachePath(options.cache_dir)
return options, args
......
......@@ -1083,11 +1083,12 @@ class Changelist(object):
remote, = remotes
elif 'origin' in remotes:
remote = 'origin'
logging.warn('Could not determine which remote this change is '
'associated with, so defaulting to "%s".' % self._remote)
logging.warning('Could not determine which remote this change is '
'associated with, so defaulting to "%s".' %
self._remote)
else:
logging.warn('Could not determine which remote this change is '
'associated with.')
logging.warning('Could not determine which remote this change is '
'associated with.')
branch = 'HEAD'
if branch.startswith('refs/remotes'):
self._remote = (remote, branch)
......
......@@ -193,7 +193,7 @@ def main():
ninjalog = args.ninjalog or GetNinjalog(args.cmdline)
if not os.path.isfile(ninjalog):
logging.warn("ninjalog is not found in %s", ninjalog)
logging.warning("ninjalog is not found in %s", ninjalog)
return 1
# We assume that each ninja invocation interval takes at least 2 seconds.
......@@ -221,7 +221,8 @@ def main():
headers={'Content-Encoding': 'gzip'})
if resp_headers.status != 200:
logging.warn("unexpected status code for response: %s", resp_headers.status)
logging.warning("unexpected status code for response: %s",
resp_headers.status)
return 1
logging.info('response header: %s', resp_headers)
......
......@@ -1901,7 +1901,7 @@ def canned_check_filter(method_names):
try:
for method_name in method_names:
if not hasattr(presubmit_canned_checks, method_name):
logging.warn('Skipping unknown "canned" check %s' % method_name)
logging.warning('Skipping unknown "canned" check %s' % method_name)
continue
filtered[method_name] = getattr(presubmit_canned_checks, method_name)
setattr(presubmit_canned_checks, method_name, lambda *_a, **_kw: [])
......
......@@ -203,8 +203,8 @@ def checkout_engine(engine_path, repo_root, recipes_cfg_path):
os.remove(index_lock)
except OSError as exc:
if exc.errno != errno.ENOENT:
logging.warn('failed to remove %r, reset will fail: %s', index_lock,
exc)
logging.warning('failed to remove %r, reset will fail: %s',
index_lock, exc)
_git_check_call(['reset', '-q', '--hard', revision], cwd=engine_path)
# If the engine has refactored/moved modules we need to clean all .pyc files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment