| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Bundles a universe_view into a standalone folder. | 6 """Bundles a universe_view into a standalone folder. |
| 7 | 7 |
| 8 This captures the result of doing all the network operations that recipe_engine | 8 This captures the result of doing all the network operations that recipe_engine |
| 9 might do at startup. | 9 might do at startup. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 from __future__ import absolute_import | 12 from __future__ import absolute_import |
| 13 import errno | 13 import errno |
| 14 import logging | 14 import logging |
| 15 import os | 15 import os |
| 16 import io | 16 import io |
| 17 import re | |
| 18 import shutil | 17 import shutil |
| 19 import stat | 18 import stat |
| 20 import subprocess | 19 import subprocess |
| 21 import sys | 20 import sys |
| 22 import types | |
| 23 | 21 |
| 24 LOGGER = logging.getLogger(__name__) | 22 LOGGER = logging.getLogger(__name__) |
| 25 | 23 |
| 26 def prepare_destination(destination): | 24 def prepare_destination(destination): |
| 27 LOGGER.info('prepping destination %s', destination) | 25 LOGGER.info('prepping destination %s', destination) |
| 28 destination = os.path.abspath(destination) | 26 destination = os.path.abspath(destination) |
| 29 if os.path.exists(destination): | 27 if os.path.exists(destination): |
| 30 LOGGER.fatal( | 28 LOGGER.fatal( |
| 31 'directory %s already exists! The directory must not exist to use it as ' | 29 'directory %s already exists! The directory must not exist to use it as ' |
| 32 'a bundle target.', destination) | 30 'a bundle target.', destination) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 will be tuned to run commands using this package. | 117 will be tuned to run commands using this package. |
| 120 universe (loader.RecipeUniverse) - All of the recipes necessary to support | 118 universe (loader.RecipeUniverse) - All of the recipes necessary to support |
| 121 root_package. | 119 root_package. |
| 122 destination (str) - Path to the bundle output folder. This folder should not | 120 destination (str) - Path to the bundle output folder. This folder should not |
| 123 exist before calling this function. | 121 exist before calling this function. |
| 124 """ | 122 """ |
| 125 destination = prepare_destination(destination) | 123 destination = prepare_destination(destination) |
| 126 for pkg in universe.packages: | 124 for pkg in universe.packages: |
| 127 export_package(pkg, destination) | 125 export_package(pkg, destination) |
| 128 prep_recipes_py(universe, root_package, destination) | 126 prep_recipes_py(universe, root_package, destination) |
| OLD | NEW |