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

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

Issue 155089: Remove any double qoutes from defines, fed into bindings generator.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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 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_binding.py INPUT CPPDIR HDIR -- INPUTS -- OPTIONS 7 # usage: rule_binding.py INPUT CPPDIR HDIR -- INPUTS -- OPTIONS
8 # 8 #
9 # INPUT is an IDL file, such as Whatever.idl. 9 # INPUT is an IDL file, such as Whatever.idl.
10 # 10 #
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 for perl_module in perl_modules: 66 for perl_module in perl_modules:
67 include_dir = os.path.dirname(perl_module) 67 include_dir = os.path.dirname(perl_module)
68 if not include_dir in include_dirs: 68 if not include_dir in include_dirs:
69 include_dirs.append(include_dir) 69 include_dirs.append(include_dir)
70 70
71 # Build up the command. 71 # Build up the command.
72 command = ['perl', '-w'] 72 command = ['perl', '-w']
73 for include_dir in include_dirs: 73 for include_dir in include_dirs:
74 command.extend(['-I', include_dir]) 74 command.extend(['-I', include_dir])
75 command.append(generate_bindings) 75 command.append(generate_bindings)
76 command.extend(options) 76 # Remove any qouble qoutes that may have gotten in here. We know that none of
77 # the options will have meaningful double qoutes.
Ben Laurie 2009/07/06 16:11:20 To defend against the possibility of a define that
78 command.extend([option.replace('"', '') for option in options])
77 command.extend(['--outputDir', cppdir, input]) 79 command.extend(['--outputDir', cppdir, input])
78 80
79 # Do it. check_call is new in 2.5, so simulate its behavior with call and 81 # Do it. check_call is new in 2.5, so simulate its behavior with call and
80 # assert. 82 # assert.
81 return_code = subprocess.call(command) 83 return_code = subprocess.call(command)
82 assert return_code == 0 84 assert return_code == 0
83 85
84 # Both the .cpp and .h were generated in cppdir, but if hdir is different, 86 # Both the .cpp and .h were generated in cppdir, but if hdir is different,
85 # the .h needs to move. Copy it instead of using os.rename for maximum 87 # the .h needs to move. Copy it instead of using os.rename for maximum
86 # portability in all cases. 88 # portability in all cases.
87 if cppdir != hdir: 89 if cppdir != hdir:
88 input_basename = os.path.basename(input) 90 input_basename = os.path.basename(input)
89 (root, ext) = os.path.splitext(input_basename) 91 (root, ext) = os.path.splitext(input_basename)
90 hname = 'V8%s.h' % root 92 hname = 'V8%s.h' % root
91 hsrc = os.path.join(cppdir, hname) 93 hsrc = os.path.join(cppdir, hname)
92 hdst = os.path.join(hdir, hname) 94 hdst = os.path.join(hdir, hname)
93 shutil.copyfile(hsrc, hdst) 95 shutil.copyfile(hsrc, hdst)
94 os.unlink(hsrc) 96 os.unlink(hsrc)
95 97
96 return return_code 98 return return_code
97 99
98 100
99 if __name__ == '__main__': 101 if __name__ == '__main__':
100 sys.exit(main(sys.argv)) 102 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698