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: Addressed further feedback Created Oct. 16, 2015, 10:19 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 16 matching lines...) Expand all
27 # File to update this script from (optional) 27 # File to update this script from (optional)
28 _self = buildtools/ensure_dependencies.py 28 _self = buildtools/ensure_dependencies.py
29 # Clone elemhidehelper repository into extensions/elemhidehelper directory at 29 # Clone elemhidehelper repository into extensions/elemhidehelper directory at
30 # tag "1.2". 30 # tag "1.2".
31 extensions/elemhidehelper = elemhidehelper 1.2 31 extensions/elemhidehelper = elemhidehelper 1.2
32 # Clone buildtools repository into buildtools directory at VCS-specific 32 # Clone buildtools repository into buildtools directory at VCS-specific
33 # revision IDs. 33 # revision IDs.
34 buildtools = buildtools hg:016d16f7137b git:f3f8692f82e5 34 buildtools = buildtools hg:016d16f7137b git:f3f8692f82e5
35 # Clone the adblockplus repository into adblockplus directory, overwriting the 35 # Clone the adblockplus repository into adblockplus directory, overwriting the
36 # usual source URL for Git repository and specifying VCS specific revision IDs . 36 # usual source URL for Git repository and specifying VCS specific revision IDs .
37 adblockplus = adblockplus hg:893426c6a6ab git:git@github.com:kzar/adblockplus. git@b2ffd52b 37 adblockplus = adblockplus hg:893426c6a6ab git:git@github.com:user/adblockplus. git@b2ffd52b
38 # Clone the adblockpluschrome repository into the adblockpluschrome directory, 38 # Clone the adblockpluschrome repository into the adblockpluschrome directory,
39 # from a specific Git repository, specifying the revision ID. 39 # from a specific Git repository, specifying the revision ID.
40 adblockpluschrome = git:git@github.com:kzar/adblockpluschrome.git@1fad3a7 40 adblockpluschrome = git:git@github.com:user/adblockpluschrome.git@1fad3a7
Wladimir Palant 2015/10/16 10:28:45 Nit: I don't think your username belongs in the ex
kzar 2015/10/16 10:44:52 Done.
41 """ 41 """
42 42
43 SKIP_DEPENDENCY_UPDATES = os.environ.get( 43 SKIP_DEPENDENCY_UPDATES = os.environ.get(
44 "SKIP_DEPENDENCY_UPDATES", "" 44 "SKIP_DEPENDENCY_UPDATES", ""
45 ).lower() not in ("", "0", "false") 45 ).lower() not in ("", "0", "false")
46 46
47 class Mercurial(): 47 class Mercurial():
48 def istype(self, repodir): 48 def istype(self, repodir):
49 return os.path.exists(os.path.join(repodir, ".hg")) 49 return os.path.exists(os.path.join(repodir, ".hg"))
50 50
(...skipping 96 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 ())
Sebastian Noack 2015/10/16 10:24:49 Nit: Is coercing to a tuple really necessary? Won'
kzar 2015/10/16 10:44:52 You're right, a list will do. (I figured a tuple w
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