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

Side by Side Diff: third_party/cython/python_flags.py

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import sys 7 import sys
8 8 import sysconfig
9 from distutils import sysconfig
10 from distutils.command import build_ext
11 from distutils.dist import Distribution
12 from distutils.extension import Extension
13 9
14 def main(): 10 def main():
15 """Command line utility to retrieve compilation options for python modules' 11 """Command line utility to retrieve compilation options for python modules'
16 """ 12 """
17 parser = argparse.ArgumentParser( 13 parser = argparse.ArgumentParser(
18 description='Retrieves compilation options for python modules.') 14 description='Retrieves compilation options for python modules.')
19 parser.add_argument('--libraries', help='Returns libraries', 15 parser.add_argument('--libraries', help='Returns libraries',
20 action='store_true') 16 action='store_true')
21 parser.add_argument('--includes', help='Returns includes', 17 parser.add_argument('--includes', help='Returns includes',
22 action='store_true') 18 action='store_true')
23 parser.add_argument('--library_dirs', help='Returns library_dirs', 19 parser.add_argument('--library_dirs', help='Returns library_dirs',
24 action='store_true') 20 action='store_true')
25 opts = parser.parse_args() 21 opts = parser.parse_args()
26 22
27 ext = Extension('Dummy', [])
28 b = build_ext.build_ext(Distribution())
29 b.initialize_options()
30 b.finalize_options()
31 result = [] 23 result = []
24
32 if opts.libraries: 25 if opts.libraries:
33 libraries = b.get_libraries(ext) 26 python_lib = sysconfig.get_config_var('LDLIBRARY')
34 if sys.platform == 'darwin': 27 if python_lib.endswith(".so"):
35 libraries.append('python%s' % sys.version[:3]) 28 python_lib = python_lib[:-3]
36 result.extend(libraries) 29 if python_lib.startswith("lib"):
30 python_lib = python_lib[3:]
31
32 result.append(python_lib)
33
37 if opts.includes: 34 if opts.includes:
38 result = result + b.include_dirs 35 result.append(sysconfig.get_config_var('INCLUDEPY'))
36
39 if opts.library_dirs: 37 if opts.library_dirs:
40 if sys.platform == 'darwin': 38 result.append(sysconfig.get_config_var('BINLIBDEST'))
41 result.append('%s/lib' % sysconfig.get_config_vars('prefix')[0])
42 39
43 for x in result: 40 for x in result:
44 print x 41 print x
45 42
46 if __name__ == '__main__': 43 if __name__ == '__main__':
47 main() 44 main()
OLDNEW
« no previous file with comments | « testing/chromoting/chromoting_integration_tests.isolate ('k') | third_party/harfbuzz-ng/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698