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

Side by Side Diff: mojo/tools/utils.py

Issue 1338793003: third_party/mojo: stop syncing from the Mojo repository. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « mojo/tools/rev_sdk.py ('k') | third_party/mojo/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import fnmatch
7 import os
8 import subprocess
9
10 chromium_root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
11 os.pardir, os.pardir)
12
13 def commit(message, cwd=None):
14 subprocess.call(['git', 'commit', '-a', '-m', message], cwd=cwd)
15
16 def system(command, cwd=None):
17 return subprocess.check_output(command, cwd=cwd)
18
19 def find(patterns, start='.'):
20 for path, dirs, files in os.walk(start):
21 for basename in files + dirs:
22 if any([fnmatch.fnmatch(basename, pattern) for pattern in patterns]):
23 filename = os.path.join(path, basename)
24 yield filename
25
26 def filter_file(path, predicate):
27 with open(path, 'r+') as f:
28 lines = f.readlines()
29 new_lines = [line for line in lines if predicate(line)]
30 f.seek(0)
31 f.truncate()
32 f.write(''.join(new_lines))
OLDNEW
« no previous file with comments | « mojo/tools/rev_sdk.py ('k') | third_party/mojo/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698