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

Side by Side Diff: scripts/slave/recipe_modules/zip/example.py

Issue 1101673005: Extract functions from path recipe module so that step can depend on it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 years, 8 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
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 'file',
6 'path', 7 'path',
7 'platform', 8 'platform',
8 'step', 9 'step',
9 'zip', 10 'zip',
10 ] 11 ]
11 12
12 def GenSteps(api): 13 def GenSteps(api):
13 # Prepare files. 14 # Prepare files.
14 temp = api.path.mkdtemp('zip-example') 15 temp = api.path.mkdtemp('zip-example')
15 api.step('touch a', ['touch', temp.join('a')]) 16 api.step('touch a', ['touch', temp.join('a')])
16 api.step('touch b', ['touch', temp.join('b')]) 17 api.step('touch b', ['touch', temp.join('b')])
17 api.path.makedirs('mkdirs', temp.join('sub', 'dir')) 18 api.file.makedirs('mkdirs', temp.join('sub', 'dir'))
18 api.step('touch c', ['touch', temp.join('sub', 'dir', 'c')]) 19 api.step('touch c', ['touch', temp.join('sub', 'dir', 'c')])
19 20
20 # Build zip using 'zip.directory'. 21 # Build zip using 'zip.directory'.
21 api.zip.directory('zipping', temp, temp.join('output.zip')) 22 api.zip.directory('zipping', temp, temp.join('output.zip'))
22 23
23 # Build a zip using ZipPackage api. 24 # Build a zip using ZipPackage api.
24 package = api.zip.make_package(temp, temp.join('more.zip')) 25 package = api.zip.make_package(temp, temp.join('more.zip'))
25 package.add_file(package.root.join('a')) 26 package.add_file(package.root.join('a'))
26 package.add_file(package.root.join('b')) 27 package.add_file(package.root.join('b'))
27 package.add_directory(package.root.join('sub')) 28 package.add_directory(package.root.join('sub'))
28 package.zip('zipping more') 29 package.zip('zipping more')
29 30
30 # Coverage for 'output' property. 31 # Coverage for 'output' property.
31 api.step('report', ['echo', package.output]) 32 api.step('report', ['echo', package.output])
32 33
33 # Unzip the package. 34 # Unzip the package.
34 api.zip.unzip('unzipping', temp.join('output.zip'), temp.join('output')) 35 api.zip.unzip('unzipping', temp.join('output.zip'), temp.join('output'))
35 # List unzipped content. 36 # List unzipped content.
36 api.step('listing', ['find'], cwd=temp.join('output')) 37 api.step('listing', ['find'], cwd=temp.join('output'))
37 # Clean up. 38 # Clean up.
38 api.path.rmtree('cleanup', temp) 39 api.file.rmtree('cleanup', temp)
39 40
40 41
41 def GenTests(api): 42 def GenTests(api):
42 for platform in ('linux', 'win', 'mac'): 43 for platform in ('linux', 'win', 'mac'):
43 yield api.test(platform) + api.platform.name(platform) 44 yield api.test(platform) + api.platform.name(platform)
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/webrtc/api.py ('k') | scripts/slave/recipes/blink_android_trybot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698