OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Package Management | 6 """Package Management |
7 | 7 |
8 This module is used to bring in external Python dependencies via eggs from the | 8 This module is used to bring in external Python dependencies via eggs from the |
9 PyPi repository. | 9 PyPi repository. |
10 | 10 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 having been added to the parent process as it may cause packages to be | 465 having been added to the parent process as it may cause packages to be |
466 added and/or removed. | 466 added and/or removed. |
467 | 467 |
468 Returns: | 468 Returns: |
469 True on success, False otherwise. | 469 True on success, False otherwise. |
470 """ | 470 """ |
471 if _SiteDirectoryIsUpToDate(): | 471 if _SiteDirectoryIsUpToDate(): |
472 return True | 472 return True |
473 | 473 |
474 try: | 474 try: |
475 AddSiteDirectory(SITE_DIR) | 475 EnsureSiteDirectory(SITE_DIR) |
476 import pkg_resources | 476 import pkg_resources |
477 | 477 |
478 # Determine if any packages actually need installing. | 478 # Determine if any packages actually need installing. |
479 missing_packages = [] | 479 missing_packages = [] |
480 for package in [SETUPTOOLS] + list(PACKAGES): | 480 for package in [SETUPTOOLS] + list(PACKAGES): |
481 pkg = Package(*package) | 481 pkg = Package(*package) |
482 req = pkg.GetAsRequirementString() | 482 req = pkg.GetAsRequirementString() |
483 | 483 |
484 # It may be that this package is already available in the site | 484 # It may be that this package is already available in the site |
485 # directory. If so, we can skip past it without trying to install it. | 485 # directory. If so, we can skip past it without trying to install it. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 exec('result = %s' % sys.argv[1]) | 593 exec('result = %s' % sys.argv[1]) |
594 | 594 |
595 # Translate the success state to a return code. | 595 # Translate the success state to a return code. |
596 return not result | 596 return not result |
597 else: | 597 else: |
598 return not SetupSiteDirectory() | 598 return not SetupSiteDirectory() |
599 | 599 |
600 | 600 |
601 if __name__ == '__main__': | 601 if __name__ == '__main__': |
602 sys.exit(Main()) | 602 sys.exit(Main()) |
OLD | NEW |