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

Side by Side Diff: test/intermediate_dir/src/script.py

Issue 10829252: Fix usage of shlex in unit tests on windows. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/same-rule-output-file-name/src/touch.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # Copyright (c) 2011 Google Inc. 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 # Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument, 6 # Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument,
7 # and writes the absolute path to the file in the 2nd argument to the file in 7 # and writes the absolute path to the file in the 2nd argument to the file in
8 # the 3rd argument. 8 # the 3rd argument.
9 9
10 import os 10 import os
11 import shlex 11 import shlex
12 import sys 12 import sys
13 13
14 if len(sys.argv) == 3 and ' ' in sys.argv[2]: 14 if len(sys.argv) == 3 and ' ' in sys.argv[2]:
15 sys.argv[2], fourth = shlex.split(sys.argv[2]) 15 sys.argv[2], fourth = shlex.split(sys.argv[2].replace('\\', '\\\\'))
16 sys.argv.append(fourth) 16 sys.argv.append(fourth)
17 17
18 #print >>sys.stderr, sys.argv 18 #print >>sys.stderr, sys.argv
19 19
20 with open(sys.argv[2], 'w') as f: 20 with open(sys.argv[2], 'w') as f:
21 f.write(sys.argv[1]) 21 f.write(sys.argv[1])
22 22
23 with open(sys.argv[3], 'w') as f: 23 with open(sys.argv[3], 'w') as f:
24 f.write(os.path.abspath(sys.argv[2])) 24 f.write(os.path.abspath(sys.argv[2]))
OLDNEW
« no previous file with comments | « no previous file | test/same-rule-output-file-name/src/touch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698