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

Side by Side Diff: scripts/slave/recipe_modules/path/config.py

Issue 24737002: Add Paths as first-class types in configs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Address comments Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from slave.recipe_config import config_item_context, ConfigGroup, Dict, Static
6 from slave.recipe_config_types import Path
7
8 def BaseConfig(CURRENT_WORKING_DIR, **_kwargs):
9 assert CURRENT_WORKING_DIR[0].endswith(('\\', '/'))
10 return ConfigGroup(
11 # base path name -> [tokenized absolute path]
12 base_paths = Dict(value_type=tuple),
13
14 # dynamic path name -> Path object (referencing one of the base_paths)
15 dynamic_paths = Dict(value_type=(Path, type(None))),
16
17 CURRENT_WORKING_DIR = Static(tuple(CURRENT_WORKING_DIR)),
18 )
19
20 VAR_TEST_MAP = {
21 'CURRENT_WORKING_DIR': (
22 ['/', 'b', 'build', 'slave', 'fake_slave', 'build'],
23 ['E:\\', 'build', 'slave', 'fake_slave', 'build'],
24 ),
25 }
26
27 def test_name(args):
28 if args['CURRENT_WORKING_DIR'][0] == '/':
29 return 'posix'
30 else:
31 return 'windows'
32
33 config_ctx = config_item_context(BaseConfig, VAR_TEST_MAP, test_name)
34
35 @config_ctx(is_root=True)
36 def BASE(c):
37 c.base_paths['cwd'] = c.CURRENT_WORKING_DIR
38
39 @config_ctx()
40 def buildbot(c):
41 c.base_paths['root'] = c.CURRENT_WORKING_DIR[:-4]
42 c.base_paths['slave_build'] = c.CURRENT_WORKING_DIR
43 for token in ('build_internal', 'build', 'depot_tools'):
44 c.base_paths[token] = c.base_paths['root'] + (token,)
45 c.dynamic_paths['checkout'] = None
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698