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

Unified Diff: toolchain_build/command.py

Issue 11363043: Finish details of newlib install (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 1 month 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 | « no previous file | toolchain_build/toolchain_build.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: toolchain_build/command.py
diff --git a/toolchain_build/command.py b/toolchain_build/command.py
index 57634f50288cbb2a98ca988d47906b5697439fd5..fee519497e0e4a8dc96128c019c96f8124948fd0 100755
--- a/toolchain_build/command.py
+++ b/toolchain_build/command.py
@@ -127,3 +127,30 @@ def RemoveDirectory(path):
"""Convenience method for generating a command to remove a directory tree."""
# TODO(mcgrathr): Windows
return Command(['rm', '-rf', path])
+
+
+def Remove(path):
+ """Convenience method for generating a command to remove a file."""
+ # TODO(mcgrathr): Replace with something less hacky.
+ return Command([
+ sys.executable, '-c',
+ 'import sys, os; os.remove(sys.argv[1])', path
+ ])
+
+
+def Rename(src, dst):
+ """Convenience method for generating a command to rename a file."""
+ # TODO(mcgrathr): Replace with something less hacky.
+ return Command([
+ sys.executable, '-c',
+ 'import sys, os; os.rename(sys.argv[1], sys.argv[2])', src, dst
+ ])
+
+
+def WriteData(data, dst):
+ """Convenience method to write a file with fixed contents."""
+ # TODO(mcgrathr): Replace with something less hacky.
+ return Command([
+ sys.executable, '-c',
+ 'import sys; open(sys.argv[1], "wb").write(%r)' % data, dst
+ ])
« no previous file with comments | « no previous file | toolchain_build/toolchain_build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698