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

Side by Side Diff: ensure_dependencies.py

Issue 5784154620821504: Issue 1807 - Allow suppressing output of ensure_dependencies.py (Closed)
Patch Set: Created Jan. 14, 2015, 9:14 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 # coding: utf-8 2 # coding: utf-8
3 3
4 # This Source Code Form is subject to the terms of the Mozilla Public 4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 7
8 import sys 8 import sys
9 import os 9 import os
10 import posixpath 10 import posixpath
11 import re 11 import re
12 import io 12 import io
13 import errno 13 import errno
14 import logging 14 import logging
15 import subprocess 15 import subprocess
16 import urlparse 16 import urlparse
17 import argparse
17 18
18 from collections import OrderedDict 19 from collections import OrderedDict
19 from ConfigParser import RawConfigParser 20 from ConfigParser import RawConfigParser
20 21
21 USAGE = """ 22 USAGE = """
22 A dependencies file should look like this: 23 A dependencies file should look like this:
23 24
24 # VCS-specific root URLs for the repositories 25 # VCS-specific root URLs for the repositories
25 _root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/ 26 _root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/
26 # File to update this script from (optional) 27 # File to update this script from (optional)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 file_content = [l.strip() for l in f.readlines()] 272 file_content = [l.strip() for l in f.readlines()]
272 if not pattern in file_content: 273 if not pattern in file_content:
273 file_content.append(pattern) 274 file_content.append(pattern)
274 f.seek(0, os.SEEK_SET) 275 f.seek(0, os.SEEK_SET)
275 f.truncate() 276 f.truncate()
276 for l in file_content: 277 for l in file_content:
277 print >>f, l 278 print >>f, l
278 279
279 if __name__ == "__main__": 280 if __name__ == "__main__":
280 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) 281 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
281 repos = sys.argv[1:] 282
283 parser = argparse.ArgumentParser(description="Verify dependencies for a set of repositories, by default the repository of this script.")
284 parser.add_argument("repos", metavar="repository", type=str, nargs="*", help=" Repository path")
285 parser.add_argument("-q", "--quiet", action="store_true", help="Suppress infor mational output")
286 args = parser.parse_args()
287
288 if args.quiet:
289 logging.disable(logging.INFO)
290
291 repos = args.repos
282 if not len(repos): 292 if not len(repos):
283 repos = [os.path.dirname(__file__)] 293 repos = [os.path.dirname(__file__)]
284 for repo in repos: 294 for repo in repos:
285 resolve_deps(repo) 295 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