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

Side by Side Diff: recipe_modules/shutil/api.py

Issue 2141223002: Revert of shutil recipe_module: port chromium_utils rmtree implementation. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: how about this? Created 4 years, 5 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 | « no previous file | recipe_modules/shutil/example.expected/basic.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The LUCI Authors. All rights reserved. 1 # Copyright 2016 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 import recipe_api 5 from recipe_engine import recipe_api
6 6
7 class ShutilApi(recipe_api.RecipeApi): 7 class ShutilApi(recipe_api.RecipeApi):
8 def rmtree(self, path, **kwargs): 8 def rmtree(self, path, **kwargs):
9 name = kwargs.pop('name', 'rmtree %s' % path) 9 name = kwargs.pop('name', 'rmtree %s' % path)
10 self.m.python( 10 self.m.python.inline(
11 name, 11 name,
12 self.resource('rmtree.py'), 12 """
13 import shutil, sys
14 shutil.rmtree(sys.argv[1])
15 """,
13 args=[path], 16 args=[path],
14 **kwargs) 17 **kwargs)
15 18
16 def copy(self, name, source, dest, step_test_data=None, **kwargs): 19 def copy(self, name, source, dest, step_test_data=None, **kwargs):
17 """Copy a file.""" 20 """Copy a file."""
18 return self.m.python.inline( 21 return self.m.python.inline(
19 name, 22 name,
20 """ 23 """
21 import shutil 24 import shutil
22 import sys 25 import sys
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if not os.path.isdir(path): 134 if not os.path.isdir(path):
132 if os.path.exists(path): 135 if os.path.exists(path):
133 print "%s exists but is not a dir" % path 136 print "%s exists but is not a dir" % path
134 sys.exit(1) 137 sys.exit(1)
135 os.makedirs(path, mode) 138 os.makedirs(path, mode)
136 """, 139 """,
137 args=[path, str(mode)], 140 args=[path, str(mode)],
138 **kwargs 141 **kwargs
139 ) 142 )
140 self.m.path.mock_add_paths(path) 143 self.m.path.mock_add_paths(path)
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/shutil/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698