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

Unified Diff: mojo/tools/utils.py

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/tools/rev_sdk.py ('k') | native_client_sdk/src/examples/demo/nacl_io_demo/example.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/utils.py
diff --git a/mojo/tools/utils.py b/mojo/tools/utils.py
new file mode 100755
index 0000000000000000000000000000000000000000..740b363330c85ea64946186062fcaaa472d90b60
--- /dev/null
+++ b/mojo/tools/utils.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import fnmatch
+import os
+import subprocess
+
+chromium_root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ os.pardir, os.pardir)
+
+def commit(message, cwd=None):
+ subprocess.call(['git', 'commit', '-a', '-m', message], cwd=cwd)
+
+def system(command, cwd=None):
+ return subprocess.check_output(command, cwd=cwd)
+
+def find(patterns, start='.'):
+ for path, dirs, files in os.walk(start):
+ for basename in files + dirs:
+ if any([fnmatch.fnmatch(basename, pattern) for pattern in patterns]):
+ filename = os.path.join(path, basename)
+ yield filename
+
+def filter_file(path, predicate):
+ with open(path, 'r+') as f:
+ lines = f.readlines()
+ new_lines = [line for line in lines if predicate(line)]
+ f.seek(0)
+ f.truncate()
+ f.write(''.join(new_lines))
« no previous file with comments | « mojo/tools/rev_sdk.py ('k') | native_client_sdk/src/examples/demo/nacl_io_demo/example.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698