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

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

Issue 1866313002: recipe engine: add tempfile and shutil modules (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: presubmit Created 4 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
OLDNEW
(Empty)
1 # Copyright 2016 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 import contextlib
6
7 from recipe_engine import recipe_api
8
9
10 class TempfileApi(recipe_api.RecipeApi):
11 @contextlib.contextmanager
12 def temp_dir(self, prefix):
martiniss 2016/04/07 17:35:22 This (roughly) already exists at https://github.co
Paweł Hajdan Jr. 2016/04/07 20:39:04 Yes, in fact this method calls path.mkdtemp .
martiniss 2016/04/07 21:34:02 I mis-read this function, sorry.
iannucci 2016/04/08 00:19:20 This is fine for now, but this is really the wrong
Paweł Hajdan Jr. 2016/04/08 07:46:15 The circular dependency was path -> python -> step
13 path = None
14 try:
15 path = self.m.path.mkdtemp(prefix)
16 yield path
17 finally:
18 if path:
19 self.m.shutil.rmtree(path, infra_step=True)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698