Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: gclient.py

Issue 546022: gclient: git relative url implementation (Closed)
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2008 Google Inc. All Rights Reserved. 3 # Copyright 2008 Google Inc. All Rights Reserved.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 Error: If a dependency conflicts with another dependency or of a solution. 511 Error: If a dependency conflicts with another dependency or of a solution.
512 """ 512 """
513 deps = {} 513 deps = {}
514 for solution in self.GetVar("solutions"): 514 for solution in self.GetVar("solutions"):
515 custom_vars = solution.get("custom_vars", {}) 515 custom_vars = solution.get("custom_vars", {})
516 solution_deps = self._ParseSolutionDeps( 516 solution_deps = self._ParseSolutionDeps(
517 solution["name"], 517 solution["name"],
518 solution_deps_content[solution["name"]], 518 solution_deps_content[solution["name"]],
519 custom_vars) 519 custom_vars)
520 520
521 local_scope = {}
522 var = self._VarImpl(custom_vars, local_scope)
523 global_scope = {"From": self.FromImpl, "Var": var.Lookup, "deps_os": {}}
524 exec(solution_deps_content[solution["name"]], global_scope, local_scope)
525
526 # If a line is in custom_deps, but not in the solution, we want to append 521 # If a line is in custom_deps, but not in the solution, we want to append
527 # this line to the solution. 522 # this line to the solution.
528 if "custom_deps" in solution: 523 if "custom_deps" in solution:
529 for d in solution["custom_deps"]: 524 for d in solution["custom_deps"]:
530 if d not in solution_deps: 525 if d not in solution_deps:
531 solution_deps[d] = solution["custom_deps"][d] 526 solution_deps[d] = solution["custom_deps"][d]
532 527
533 for d in solution_deps: 528 for d in solution_deps:
534 if "custom_deps" in solution and d in solution["custom_deps"]: 529 if "custom_deps" in solution and d in solution["custom_deps"]:
535 # Dependency is overriden. 530 # Dependency is overriden.
(...skipping 17 matching lines...) Expand all
553 continue 548 continue
554 else: 549 else:
555 parsed_url = urlparse.urlparse(url) 550 parsed_url = urlparse.urlparse(url)
556 scheme = parsed_url[0] 551 scheme = parsed_url[0]
557 if not scheme: 552 if not scheme:
558 # A relative url. Fetch the real base. 553 # A relative url. Fetch the real base.
559 path = parsed_url[2] 554 path = parsed_url[2]
560 if path[0] != "/": 555 if path[0] != "/":
561 raise gclient_utils.Error( 556 raise gclient_utils.Error(
562 "relative DEPS entry \"%s\" must begin with a slash" % d) 557 "relative DEPS entry \"%s\" must begin with a slash" % d)
563 if local_scope.get('use_relative_urls2'): 558 # Create a scm just to query the full url.
564 url = gclient_utils.FullUrlFromRelative2(solution["url"], url) 559 scm = gclient_scm.CreateSCM(solution["url"], self._root_dir,
565 else: 560 None)
566 url = gclient_utils.FullUrlFromRelative(solution["url"], url) 561 url = scm.FullUrlForRelativeUrl(url)
567 if d in deps and deps[d] != url: 562 if d in deps and deps[d] != url:
568 raise gclient_utils.Error( 563 raise gclient_utils.Error(
569 "Solutions have conflicting versions of dependency \"%s\"" % d) 564 "Solutions have conflicting versions of dependency \"%s\"" % d)
570 if d in solution_urls and solution_urls[d] != url: 565 if d in solution_urls and solution_urls[d] != url:
571 raise gclient_utils.Error( 566 raise gclient_utils.Error(
572 "Dependency \"%s\" conflicts with specified solution" % d) 567 "Dependency \"%s\" conflicts with specified solution" % d)
573 # Grab the dependency. 568 # Grab the dependency.
574 deps[d] = url 569 deps[d] = url
575 return deps 570 return deps
576 571
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1183
1189 if "__main__" == __name__: 1184 if "__main__" == __name__:
1190 try: 1185 try:
1191 result = Main(sys.argv) 1186 result = Main(sys.argv)
1192 except gclient_utils.Error, e: 1187 except gclient_utils.Error, e:
1193 print >> sys.stderr, "Error: %s" % str(e) 1188 print >> sys.stderr, "Error: %s" % str(e)
1194 result = 1 1189 result = 1
1195 sys.exit(result) 1190 sys.exit(result)
1196 1191
1197 # vim: ts=2:sw=2:tw=80:et: 1192 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698