| OLD | NEW | 
|   1 # Copyright 2013 The LUCI Authors. All rights reserved. |   1 # Copyright 2013 The LUCI Authors. All rights reserved. | 
|   2 # Use of this source code is governed under the Apache License, Version 2.0 |   2 # Use of this source code is governed under the Apache License, Version 2.0 | 
|   3 # that can be found in the LICENSE file. |   3 # that can be found in the LICENSE file. | 
|   4  |   4  | 
|   5 from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static |   5 from recipe_engine.config import config_item_context, ConfigGroup, Dict, \ | 
 |   6                                  Set, Static | 
|   6 from recipe_engine.config_types import Path |   7 from recipe_engine.config_types import Path | 
|   7  |   8  | 
|   8 def BaseConfig(PLATFORM, START_DIR, TEMP_DIR, CACHE_DIR, **_kwargs): |   9 def BaseConfig(PLATFORM, START_DIR, TEMP_DIR, CACHE_DIR, **_kwargs): | 
|   9   assert START_DIR[0].endswith(('\\', '/')), START_DIR |  10   assert START_DIR[0].endswith(('\\', '/')), START_DIR | 
|  10   assert TEMP_DIR[0].endswith(('\\', '/')), TEMP_DIR |  11   assert TEMP_DIR[0].endswith(('\\', '/')), TEMP_DIR | 
|  11   assert CACHE_DIR[0].endswith(('\\', '/')), CACHE_DIR |  12   assert CACHE_DIR[0].endswith(('\\', '/')), CACHE_DIR | 
|  12   return ConfigGroup( |  13   return ConfigGroup( | 
|  13     # base path name -> [tokenized absolute path] |  14     # base path name -> [tokenized absolute path] | 
|  14     base_paths    = Dict(value_type=tuple), |  15     base_paths    = Dict(value_type=tuple), | 
|  15  |  16  | 
|  16     # dynamic path name -> Path object (referencing one of the base_paths) |  17     # dynamic path name -> Path object (referencing one of the base_paths) | 
|  17     dynamic_paths = Dict(value_type=(Path, type(None))), |  18     dynamic_paths = Dict(value_type=(Path, type(None))), | 
|  18  |  19  | 
 |  20     # Path keys from "base_paths" and "dynamic_paths" that are known to be | 
 |  21     # volatile. | 
 |  22     volatile_paths = Set(str), | 
 |  23  | 
|  19     PLATFORM = Static(PLATFORM), |  24     PLATFORM = Static(PLATFORM), | 
|  20     START_DIR = Static(tuple(START_DIR)), |  25     START_DIR = Static(tuple(START_DIR)), | 
|  21     TEMP_DIR = Static(tuple(TEMP_DIR)), |  26     TEMP_DIR = Static(tuple(TEMP_DIR)), | 
|  22     CACHE_DIR = Static(tuple(CACHE_DIR)), |  27     CACHE_DIR = Static(tuple(CACHE_DIR)), | 
|  23   ) |  28   ) | 
|  24  |  29  | 
|  25 config_ctx = config_item_context(BaseConfig) |  30 config_ctx = config_item_context(BaseConfig) | 
|  26  |  31  | 
|  27 @config_ctx(is_root=True) |  32 @config_ctx(is_root=True) | 
|  28 def BASE(c): |  33 def BASE(c): | 
|  29   c.base_paths['start_dir'] = c.START_DIR |  34   c.base_paths['start_dir'] = c.START_DIR | 
|  30   c.base_paths['tmp_base'] = c.TEMP_DIR |  35   c.base_paths['tmp_base'] = c.TEMP_DIR | 
|  31   c.base_paths['cache'] = c.CACHE_DIR |  36   c.base_paths['cache'] = c.CACHE_DIR | 
|  32   c.dynamic_paths['checkout'] = None |  37   c.dynamic_paths['checkout'] = None | 
| OLD | NEW |