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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | toolchain_build/toolchain_build.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Class capturing a command invocation as data.""" 6 """Class capturing a command invocation as data."""
7 7
8 8
9 # Done first to setup python module path. 9 # Done first to setup python module path.
10 import toolchain_env 10 import toolchain_env
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 # TODO(bradnelson): Replace with something less hacky. 120 # TODO(bradnelson): Replace with something less hacky.
121 return Command([ 121 return Command([
122 sys.executable, '-c', 122 sys.executable, '-c',
123 'import sys,shutil; shutil.copyfile(sys.argv[1], sys.argv[2])', src, dst]) 123 'import sys,shutil; shutil.copyfile(sys.argv[1], sys.argv[2])', src, dst])
124 124
125 125
126 def RemoveDirectory(path): 126 def RemoveDirectory(path):
127 """Convenience method for generating a command to remove a directory tree.""" 127 """Convenience method for generating a command to remove a directory tree."""
128 # TODO(mcgrathr): Windows 128 # TODO(mcgrathr): Windows
129 return Command(['rm', '-rf', path]) 129 return Command(['rm', '-rf', path])
130
131
132 def Remove(path):
133 """Convenience method for generating a command to remove a file."""
134 # TODO(mcgrathr): Replace with something less hacky.
135 return Command([
136 sys.executable, '-c',
137 'import sys, os; os.remove(sys.argv[1])', path
138 ])
139
140
141 def Rename(src, dst):
142 """Convenience method for generating a command to rename a file."""
143 # TODO(mcgrathr): Replace with something less hacky.
144 return Command([
145 sys.executable, '-c',
146 'import sys, os; os.rename(sys.argv[1], sys.argv[2])', src, dst
147 ])
148
149
150 def WriteData(data, dst):
151 """Convenience method to write a file with fixed contents."""
152 # TODO(mcgrathr): Replace with something less hacky.
153 return Command([
154 sys.executable, '-c',
155 'import sys; open(sys.argv[1], "wb").write(%r)' % data, dst
156 ])
OLDNEW
« 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