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

Side by Side Diff: scripts/common/filesystem.py

Issue 761253003: Add a new buildbot-tool generator for master configs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: add buildbot-tool, turn files into actual templates Created 6 years 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 2014 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 os
6
7
8 class Filesystem(object):
agable 2014/12/09 21:13:24 Seems like this should be in a tests/ directory so
Dirk Pranke 2014/12/09 21:32:00 It's used by buildbot-tool directly, not just by t
9 """A simple filesystem abstraction, useful for faking out for testing.
10
11 This is a stripped-down version of the Filesystem class provided in the
12 TYP (Test Your Project) framework: https://github.com/dpranke/typ.
13 """
14
15 def abspath(self, path):
16 return os.path.abspath(path)
17
18 def basename(self, path):
19 return os.path.basename(path)
20
21 def dirname(self, path):
22 return os.path.dirname(path)
23
24 def exists(self, *comps):
25 return os.path.exists(self.join(*comps))
26
27 def join(self, *comps):
28 return os.path.join(*comps)
29
30 def listfiles(self, path):
31 return [path for path in os.listdir(path)
32 if not os.path.isdir(path) and
33 not os.path.basename(path).startswith('.')]
34
35 def read_text_file(self, path):
36 with open(path) as fp:
37 return fp.read()
38
39 def write_text_file(self, path, contents):
40 with open(path, 'w') as fp:
41 fp.write(contents)
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | scripts/tools/buildbot-tool » ('j') | scripts/tools/buildbot_tool.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698