Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 = {} | |
|
M-A Ruel
2009/12/15 18:49:42
I would have preferred to have this code moved int
Mandeep Singh Baines
2009/12/15 20:54:30
Good idea. I'll send out a CL to do this.
| |
| 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 | |
| 521 # If a line is in custom_deps, but not in the solution, we want to append | 526 # If a line is in custom_deps, but not in the solution, we want to append |
| 522 # this line to the solution. | 527 # this line to the solution. |
| 523 if "custom_deps" in solution: | 528 if "custom_deps" in solution: |
| 524 for d in solution["custom_deps"]: | 529 for d in solution["custom_deps"]: |
| 525 if d not in solution_deps: | 530 if d not in solution_deps: |
| 526 solution_deps[d] = solution["custom_deps"][d] | 531 solution_deps[d] = solution["custom_deps"][d] |
| 527 | 532 |
| 528 for d in solution_deps: | 533 for d in solution_deps: |
| 529 if "custom_deps" in solution and d in solution["custom_deps"]: | 534 if "custom_deps" in solution and d in solution["custom_deps"]: |
| 530 # Dependency is overriden. | 535 # Dependency is overriden. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 548 continue | 553 continue |
| 549 else: | 554 else: |
| 550 parsed_url = urlparse.urlparse(url) | 555 parsed_url = urlparse.urlparse(url) |
| 551 scheme = parsed_url[0] | 556 scheme = parsed_url[0] |
| 552 if not scheme: | 557 if not scheme: |
| 553 # A relative url. Fetch the real base. | 558 # A relative url. Fetch the real base. |
| 554 path = parsed_url[2] | 559 path = parsed_url[2] |
| 555 if path[0] != "/": | 560 if path[0] != "/": |
| 556 raise gclient_utils.Error( | 561 raise gclient_utils.Error( |
| 557 "relative DEPS entry \"%s\" must begin with a slash" % d) | 562 "relative DEPS entry \"%s\" must begin with a slash" % d) |
| 558 # Create a scm just to query the full url. | 563 if local_scope.get('use_relative_urls2'): |
| 559 scm = gclient_scm.CreateSCM(solution["url"], self._root_dir, | 564 url = gclient_utils.FullUrlFromRelative2(solution["url"], url) |
| 560 None) | 565 else: |
| 561 url = scm.FullUrlForRelativeUrl(url) | 566 url = gclient_utils.FullUrlFromRelative(solution["url"], url) |
| 562 if d in deps and deps[d] != url: | 567 if d in deps and deps[d] != url: |
| 563 raise gclient_utils.Error( | 568 raise gclient_utils.Error( |
| 564 "Solutions have conflicting versions of dependency \"%s\"" % d) | 569 "Solutions have conflicting versions of dependency \"%s\"" % d) |
| 565 if d in solution_urls and solution_urls[d] != url: | 570 if d in solution_urls and solution_urls[d] != url: |
| 566 raise gclient_utils.Error( | 571 raise gclient_utils.Error( |
| 567 "Dependency \"%s\" conflicts with specified solution" % d) | 572 "Dependency \"%s\" conflicts with specified solution" % d) |
| 568 # Grab the dependency. | 573 # Grab the dependency. |
| 569 deps[d] = url | 574 deps[d] = url |
| 570 return deps | 575 return deps |
| 571 | 576 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 | 1188 |
| 1184 if "__main__" == __name__: | 1189 if "__main__" == __name__: |
| 1185 try: | 1190 try: |
| 1186 result = Main(sys.argv) | 1191 result = Main(sys.argv) |
| 1187 except gclient_utils.Error, e: | 1192 except gclient_utils.Error, e: |
| 1188 print >> sys.stderr, "Error: %s" % str(e) | 1193 print >> sys.stderr, "Error: %s" % str(e) |
| 1189 result = 1 | 1194 result = 1 |
| 1190 sys.exit(result) | 1195 sys.exit(result) |
| 1191 | 1196 |
| 1192 # vim: ts=2:sw=2:tw=80:et: | 1197 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |