Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ensure_dependencies.py

Issue 29630668: Issue 6142 - suppress missing Node.js warning when passing -q (Closed)
Patch Set: Created Dec. 5, 2017, 1:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # This Source Code Form is subject to the terms of the Mozilla Public 3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 6
7 import sys 7 import sys
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 '--no-package-lock', '--no-optional'] 291 '--no-package-lock', '--no-optional']
292 subprocess.check_output(cmd, cwd=target) 292 subprocess.check_output(cmd, cwd=target)
293 293
294 repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target) 294 repo_types[vcs].ignore(os.path.join(target, NPM_LOCKFILE), target)
295 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target) 295 repo_types[vcs].ignore(os.path.join(target, 'node_modules'), target)
296 296
297 os.remove(lockfile_path) 297 os.remove(lockfile_path)
298 except OSError as e: 298 except OSError as e:
299 import errno 299 import errno
300 if e.errno == errno.ENOENT: 300 if e.errno == errno.ENOENT:
301 logging.error('Failed to install Node.js dependencies for %s,' 301 logging.info('Failed to install Node.js dependencies for %s,'
302 ' please ensure Node.js is installed.', target) 302 ' please ensure Node.js is installed.', target)
303 else: 303 else:
304 raise 304 raise
305 305
306 306
307 def ensure_repo(parentrepo, parenttype, target, type, root, sourcename): 307 def ensure_repo(parentrepo, parenttype, target, type, root, sourcename):
308 if os.path.exists(target): 308 if os.path.exists(target):
309 return False 309 return False
310 310
311 if SKIP_DEPENDENCY_UPDATES: 311 if SKIP_DEPENDENCY_UPDATES:
312 logging.warning('SKIP_DEPENDENCY_UPDATES environment variable set, ' 312 logging.warning('SKIP_DEPENDENCY_UPDATES environment variable set, '
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 431
432 if __name__ == '__main__': 432 if __name__ == '__main__':
433 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) 433 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
434 434
435 parser = argparse.ArgumentParser(description='Verify dependencies for a set of repositories, by default the repository of this script.') 435 parser = argparse.ArgumentParser(description='Verify dependencies for a set of repositories, by default the repository of this script.')
436 parser.add_argument('repos', metavar='repository', type=str, nargs='*', help ='Repository path') 436 parser.add_argument('repos', metavar='repository', type=str, nargs='*', help ='Repository path')
437 parser.add_argument('-q', '--quiet', action='store_true', help='Suppress inf ormational output') 437 parser.add_argument('-q', '--quiet', action='store_true', help='Suppress inf ormational output')
438 args = parser.parse_args() 438 args = parser.parse_args()
439 439
440 if args.quiet: 440 if args.quiet:
tlucas 2017/12/05 14:00:12 The actual suppression happens here
441 logging.disable(logging.INFO) 441 logging.disable(logging.INFO)
442 442
443 repos = args.repos 443 repos = args.repos
444 if not len(repos): 444 if not len(repos):
445 repos = [os.path.dirname(__file__)] 445 repos = [os.path.dirname(__file__)]
446 for repo in repos: 446 for repo in repos:
447 resolve_deps(repo) 447 resolve_deps(repo)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld