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

Delta Between Two Patch Sets: ensure_dependencies.py

Issue 29360030: Issue 4581 - Update buildtools dependency (Closed)
Left Patch Set: Include ensure_dependencies.py change Created Oct. 28, 2016, 6:38 a.m.
Right Patch Set: Update buildtools again while at it Created Oct. 30, 2016, 3:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subpro cess.PIPE).communicate()[0] 63 result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subpro cess.PIPE).communicate()[0]
64 return result.strip() 64 return result.strip()
65 65
66 def pull(self, repo): 66 def pull(self, repo):
67 subprocess.check_call(['hg', 'pull', '--repository', repo, '--quiet']) 67 subprocess.check_call(['hg', 'pull', '--repository', repo, '--quiet'])
68 68
69 def update(self, repo, rev, revname): 69 def update(self, repo, rev, revname):
70 subprocess.check_call(['hg', 'update', '--repository', repo, '--quiet', '--check', '--rev', rev]) 70 subprocess.check_call(['hg', 'update', '--repository', repo, '--quiet', '--check', '--rev', rev])
71 71
72 def ignore(self, target, repo): 72 def ignore(self, target, repo):
73 73 config_path = os.path.join(repo, '.hg', 'hgrc')
74 if not self.istype(target): 74 ignore_file = os.path.join('.hg', 'dependencies')
75 75 ignore_path = os.path.join(repo, ignore_file)
76 config_path = os.path.join(repo, '.hg', 'hgrc') 76
77 ignore_path = os.path.abspath(os.path.join(repo, '.hg', 'dependencie s')) 77 config = RawConfigParser()
78 78 config.read(config_path)
79 config = RawConfigParser() 79
80 config.read(config_path) 80 if not config.has_section('ui'):
81 81 config.add_section('ui')
82 if not config.has_section('ui'): 82
83 config.add_section('ui') 83 config.set('ui', 'ignore.dependencies', ignore_file)
84 84 with open(config_path, 'w') as stream:
85 config.set('ui', 'ignore.dependencies', ignore_path) 85 config.write(stream)
86 with open(config_path, 'w') as stream: 86
87 config.write(stream) 87 module = os.path.relpath(target, repo)
88 88 _ensure_line_exists(ignore_path, module)
89 module = os.path.relpath(target, repo)
90 _ensure_line_exists(ignore_path, module)
91 89
92 def postprocess_url(self, url): 90 def postprocess_url(self, url):
93 return url 91 return url
94 92
95 93
96 class Git(): 94 class Git():
97 def istype(self, repodir): 95 def istype(self, repodir):
98 return os.path.exists(os.path.join(repodir, '.git')) 96 return os.path.exists(os.path.join(repodir, '.git'))
99 97
100 def clone(self, source, target): 98 def clone(self, source, target):
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 args = parser.parse_args() 371 args = parser.parse_args()
374 372
375 if args.quiet: 373 if args.quiet:
376 logging.disable(logging.INFO) 374 logging.disable(logging.INFO)
377 375
378 repos = args.repos 376 repos = args.repos
379 if not len(repos): 377 if not len(repos):
380 repos = [os.path.dirname(__file__)] 378 repos = [os.path.dirname(__file__)]
381 for repo in repos: 379 for repo in repos:
382 resolve_deps(repo) 380 resolve_deps(repo)
LEFTRIGHT
« dependencies ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld