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

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: Try to fix timing unit tests Created 6 years, 4 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
(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
pkl (ping after 24h if needed) 2014/08/21 09:32:48 Please add docstring. This looks like something th
qsr 2014/08/21 12:10:05 Done.
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 parser = argparse.ArgumentParser()
16 parser.add_argument('--libraries', help='Returns libraries', action='store_tru e')
17 parser.add_argument('--includes', help='Returns includes',
18 action='store_true')
19 parser.add_argument('--defines', help='Returns defines',
20 action='store_true')
21 parser.add_argument('--library_dirs', help='Returns library_dirs',
22 action='store_true')
23 opts = parser.parse_args()
24
25 ext = Extension('Dummy', [])
26 b = build_ext.build_ext(Distribution())
27 b.initialize_options()
28 b.finalize_options()
29 result = []
30 if opts.libraries:
31 libraries = b.get_libraries(ext)
32 if sys.platform == 'darwin':
33 libraries += [ '-lpython%s' % sys.version[:3] ]
34 result = result + libraries
35 if opts.includes:
36 result = result + b.include_dirs
37 if opts.defines:
38 if os.name == 'nt':
39 result.append('PyMODINIT_FUNC=extern \\"C\\" __declspec(dllexport) void')
40 else:
41 result.append(
42 'PyMODINIT_FUNC=extern \\"C\\" __attribute__((visibility(\\"default\\" ))) void')
43 if opts.library_dirs:
44 if sys.platform == 'darwin':
45 result += [ '%s/lib' % sysconfig.get_config_vars('prefix')[0] ]
pkl (ping after 24h if needed) 2014/08/21 09:32:48 Can you use result.append(...) so it is consistent
qsr 2014/08/21 12:10:05 Done.
46
47 print ''.join(['"%s"' % x for x in result])
48
49 if __name__ == '__main__':
50 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698