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

Side by Side Diff: recipe_modules/path/example.py

Issue 1925653002: recipe engine: require all path bases to be classes (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « recipe_modules/path/api.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 DEPS = [ 5 DEPS = [
6 'path', 6 'path',
7 'platform', 7 'platform',
8 'properties', 8 'properties',
9 'step', 9 'step',
10 ] 10 ]
11 11
12 from recipe_engine.config_types import Path 12 from recipe_engine.config_types import Path
13 13
14 def RunSteps(api): 14 def RunSteps(api):
15 api.step('step1', ['/bin/echo', str(api.path['tmp_base'].join('foo'))]) 15 api.step('step1', ['/bin/echo', str(api.path['tmp_base'].join('foo'))])
16 16
17 # module.resource(...) demo. 17 # module.resource(...) demo.
18 api.step('print resource', 18 api.step('print resource',
19 ['echo', api.path.resource('dir', 'file.py')]) 19 ['echo', api.path.resource('dir', 'file.py')])
20 20
21 # module.package_repo_resource() demo. 21 # module.package_repo_resource() demo.
22 api.step('print package dir', 22 api.step('print package dir',
23 ['echo', api.path.package_repo_resource('dir', 'file.py')]) 23 ['echo', api.path.package_repo_resource('dir', 'file.py')])
24 24
25 # Global dynamic paths (see config.py example for declaration):
26 dynamic_path = Path('[CHECKOUT]', 'jerky')
27
28 assert 'checkout' not in api.path 25 assert 'checkout' not in api.path
29 api.path['checkout'] = api.path['tmp_base'].join('checkout') 26 api.path['checkout'] = api.path['tmp_base'].join('checkout')
30 assert 'checkout' in api.path 27 assert 'checkout' in api.path
31 28
29 # Global dynamic paths (see config.py example for declaration):
30 dynamic_path = api.path['checkout'].join('jerky')
32 api.step('checkout path', ['/bin/echo', dynamic_path]) 31 api.step('checkout path', ['/bin/echo', dynamic_path])
33 32
34 # Methods from python os.path are available via api.path. 33 # Methods from python os.path are available via api.path.
35 # For testing, we asserted that this file existed in the test description 34 # For testing, we asserted that this file existed in the test description
36 # below. 35 # below.
37 assert api.path.exists(api.path['tmp_base']) 36 assert api.path.exists(api.path['tmp_base'])
38 37
39 temp_dir = api.path.mkdtemp('kawaab') 38 temp_dir = api.path.mkdtemp('kawaab')
40 assert api.path.exists(temp_dir) 39 assert api.path.exists(temp_dir)
41 40
(...skipping 17 matching lines...) Expand all
59 # reason. TODO(phajdan.jr) remove it. 58 # reason. TODO(phajdan.jr) remove it.
60 yield (api.test('%s_swarming' % platform) + 59 yield (api.test('%s_swarming' % platform) +
61 api.platform.name(platform) + 60 api.platform.name(platform) +
62 api.properties(path_config='swarming') + 61 api.properties(path_config='swarming') +
63 api.path.exists(api.path['tmp_base'])) 62 api.path.exists(api.path['tmp_base']))
64 63
65 yield (api.test('%s_kitchen' % platform) + 64 yield (api.test('%s_kitchen' % platform) +
66 api.platform.name(platform) + 65 api.platform.name(platform) +
67 api.properties(path_config='kitchen') + 66 api.properties(path_config='kitchen') +
68 api.path.exists(api.path['tmp_base'])) 67 api.path.exists(api.path['tmp_base']))
OLDNEW
« no previous file with comments | « recipe_modules/path/api.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698