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

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

Issue 377293002: Core mojo API for python. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dependency issue Created 6 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
« no previous file with comments | « third_party/cython/python_export.h ('k') | third_party/cython/python_module.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import argparse
6 import os
7 import sys
8
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
14 def main():
15 """Command line utility to retrieve compilation options for python modules'
16 """
17 parser = argparse.ArgumentParser(
18 description='Retrieves compilation options for python modules.')
19 parser.add_argument('--gn',
20 help='Returns all values in a format suitable for gn',
21 action='store_true')
22 parser.add_argument('--libraries', help='Returns libraries',
23 action='store_true')
24 parser.add_argument('--includes', help='Returns includes',
25 action='store_true')
26 parser.add_argument('--library_dirs', help='Returns library_dirs',
27 action='store_true')
28 opts = parser.parse_args()
29
30 ext = Extension('Dummy', [])
31 b = build_ext.build_ext(Distribution())
32 b.initialize_options()
33 b.finalize_options()
34 result = []
35 if opts.libraries:
36 libraries = b.get_libraries(ext)
37 if sys.platform == 'darwin':
38 libraries += [ '-lpython%s' % sys.version[:3] ]
39 result = result + libraries
40 if opts.includes:
41 result = result + b.include_dirs
42 if opts.library_dirs:
43 if sys.platform == 'darwin':
44 result.append('%s/lib' % sysconfig.get_config_vars('prefix')[0])
45
46 if opts.gn:
47 for x in result:
48 print x
49 else:
50 print ''.join(['"%s"' % x for x in result])
51
52 if __name__ == '__main__':
53 main()
OLDNEW
« no previous file with comments | « third_party/cython/python_export.h ('k') | third_party/cython/python_module.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698