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

Delta Between Two Patch Sets: ensure_dependencies.py

Issue 29329056: Issue 3194 - Allow multiple sources for a dependency (Closed)
Left Patch Set: Removed my username from the example Created Oct. 16, 2015, 10:32 a.m.
Right Patch Set: Just return a list from merge_seqs instead of coercing the result into a tuple Created Oct. 16, 2015, 10:43 a.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 | « no previous file | 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 # 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
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 "(.+)$" 147 "(.+)$"
148 ) 148 )
149 149
150 # [url@]rev 150 # [url@]rev
151 source_regexp = re.compile( 151 source_regexp = re.compile(
152 "^(?:(.*)@)?" 152 "^(?:(.*)@)?"
153 "(.+)$" 153 "(.+)$"
154 ) 154 )
155 155
156 def merge_seqs(seq1, seq2): 156 def merge_seqs(seq1, seq2):
157 """Return a tuple of any truthy values from the suplied sequences 157 """Return a list of any truthy values from the suplied sequences
158 158
159 (None, 2), (1,) => (1, 2) 159 (None, 2), (1,) => [1, 2]
160 None, (1, 2) => (1, 2) 160 None, (1, 2) => [1, 2]
161 (1, 2), (3, 4) => (3, 4) 161 (1, 2), (3, 4) => [3, 4]
162 """ 162 """
163 return tuple(map(lambda item1, item2: item2 or item1, seq1 or (), seq2 or ())) 163 return map(lambda item1, item2: item2 or item1, seq1 or (), seq2 or ())
164 164
165 def parse_spec(path, line): 165 def parse_spec(path, line):
166 if "=" not in line: 166 if "=" not in line:
167 logging.warning("Invalid line in file %s: %s" % (path, line)) 167 logging.warning("Invalid line in file %s: %s" % (path, line))
168 return None, None 168 return None, None
169 169
170 key, value = line.split("=", 1) 170 key, value = line.split("=", 1)
171 key = key.strip() 171 key = key.strip()
172 items = value.split() 172 items = value.split()
173 if not len(items): 173 if not len(items):
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 args = parser.parse_args() 362 args = parser.parse_args()
363 363
364 if args.quiet: 364 if args.quiet:
365 logging.disable(logging.INFO) 365 logging.disable(logging.INFO)
366 366
367 repos = args.repos 367 repos = args.repos
368 if not len(repos): 368 if not len(repos):
369 repos = [os.path.dirname(__file__)] 369 repos = [os.path.dirname(__file__)]
370 for repo in repos: 370 for repo in repos:
371 resolve_deps(repo) 371 resolve_deps(repo)
LEFTRIGHT
« no previous file | 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