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

Side by Side Diff: tools/swig/swig.py

Issue 661342: Build pyauto on win (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: using subprocess.call() Created 10 years, 9 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 | « third_party/swig/README.chromium ('k') | 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) 2010 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2010 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 """Wrapper around swig. 7 """Wrapper around swig.
8 8
9 Sets the SWIG_LIB environment var to point to Lib dir 9 Sets the SWIG_LIB environment var to point to Lib dir
10 and defers control to the platform-specific swig binary. 10 and defers control to the platform-specific swig binary.
11 11
12 Depends on swig binaries being available at ../../third_party/swig. 12 Depends on swig binaries being available at ../../third_party/swig.
13 """ 13 """
14 14
15 import os 15 import os
16 import subprocess
16 import sys 17 import sys
17 18
18 19
19 def main(): 20 def main():
20 swig_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), 21 swig_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),
21 os.pardir, os.pardir, 'third_party', 'swig')) 22 os.pardir, os.pardir, 'third_party', 'swig'))
22 lib_dir = os.path.join(swig_dir, "Lib") 23 lib_dir = os.path.join(swig_dir, "Lib")
23 os.putenv("SWIG_LIB", lib_dir) 24 os.putenv("SWIG_LIB", lib_dir)
24 dir_map = { 25 dir_map = {
25 'darwin': 'mac', 26 'darwin': 'mac',
26 'linux2': 'linux', 27 'linux2': 'linux',
27 'win32': 'win', 28 'win32': 'win',
28 'cygwin': 'win', 29 }
30 # Swig documentation lies that platform macros are provided to swig
31 # preprocessor. Provide them ourselves.
32 platform_flags = {
33 'darwin': '-DSWIGMAC',
34 'linux2': '-DSWIGLINUX',
35 'win32': '-DSWIGWIN',
29 } 36 }
30 swig_bin = os.path.join(swig_dir, dir_map[sys.platform], 'swig') 37 swig_bin = os.path.join(swig_dir, dir_map[sys.platform], 'swig')
31 os.execv(swig_bin, [swig_bin] + sys.argv[1:]) 38 args = [swig_bin, platform_flags[sys.platform]] + sys.argv[1:]
39 args = [x.replace('/', os.sep) for x in args]
40 print "Executing", args
41 sys.exit(subprocess.call(args))
32 42
33 43
34 if __name__ == "__main__": 44 if __name__ == "__main__":
35 main() 45 main()
36 46
OLDNEW
« no previous file with comments | « third_party/swig/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698