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

Side by Side Diff: webkit/build/rule_gperf.py

Issue 172032: First cut for a FreeBSD port - much still not working (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # usage: rule_gperf.py INPUT_FILE OUTPUT_DIR 7 # usage: rule_gperf.py INPUT_FILE OUTPUT_DIR
8 # INPUT_FILE is a path to DocTypeStrings.gperf, HTMLEntityNames.gperf, or 8 # INPUT_FILE is a path to DocTypeStrings.gperf, HTMLEntityNames.gperf, or
9 # ColorData.gperf. 9 # ColorData.gperf.
10 # OUTPUT_DIR is where the gperf-generated .cpp file should be placed. Because 10 # OUTPUT_DIR is where the gperf-generated .cpp file should be placed. Because
(...skipping 23 matching lines...) Expand all
34 '-CDEot', '-L', 'ANSI-C', '-k*', '-N', 'findColor', '-D', '-s', '2' 34 '-CDEot', '-L', 'ANSI-C', '-k*', '-N', 'findColor', '-D', '-s', '2'
35 ], 35 ],
36 } 36 }
37 37
38 input_name = posixpath.basename(input_file) 38 input_name = posixpath.basename(input_file)
39 assert input_name in gperf_commands 39 assert input_name in gperf_commands
40 40
41 (input_root, input_ext) = posixpath.splitext(input_name) 41 (input_root, input_ext) = posixpath.splitext(input_name)
42 output_cpp = posixpath.join(output_dir, input_root + '.cpp') 42 output_cpp = posixpath.join(output_dir, input_root + '.cpp')
43 43
44 command = ['gperf', '--output-file', output_cpp] 44 #command = ['gperf', '--output-file', output_cpp]
45 command = ['gperf']
45 command.extend(gperf_commands[input_name]) 46 command.extend(gperf_commands[input_name])
46 command.append(input_file) 47 command.append(input_file)
47 48
49 ofile = open(output_cpp, 'w')
50
48 # Do it. check_call is new in 2.5, so simulate its behavior with call and 51 # Do it. check_call is new in 2.5, so simulate its behavior with call and
49 # assert. 52 # assert.
50 return_code = subprocess.call(command) 53 return_code = subprocess.call(command, stdout=ofile.fileno())
51 assert return_code == 0 54 assert return_code == 0
52 55
53 output_c = posixpath.join(output_dir, input_root + '.c') 56 output_c = posixpath.join(output_dir, input_root + '.c')
54 shutil.copyfile(output_cpp, output_c) 57 shutil.copyfile(output_cpp, output_c)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698