Cleanup setting of 'sysroot' in common.gypi
[chromium-blink-merge.git] / third_party / cython / python_flags.py
blob3c3b93627667e2ba0340819706bb6bea94623c6c
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.
5 import argparse
6 import os
7 import sys
8 import sysconfig
10 def main():
11 """Command line utility to retrieve compilation options for python modules'
12 """
13 parser = argparse.ArgumentParser(
14 description='Retrieves compilation options for python modules.')
15 parser.add_argument('--libraries', help='Returns libraries',
16 action='store_true')
17 parser.add_argument('--includes', help='Returns includes',
18 action='store_true')
19 parser.add_argument('--library_dirs', help='Returns library_dirs',
20 action='store_true')
21 opts = parser.parse_args()
23 result = []
25 if opts.libraries:
26 python_lib = sysconfig.get_config_var('LDLIBRARY')
27 if python_lib.endswith(".so"):
28 python_lib = python_lib[:-3]
29 if python_lib.startswith("lib"):
30 python_lib = python_lib[3:]
32 result.append(python_lib)
34 if opts.includes:
35 result.append(sysconfig.get_config_var('INCLUDEPY'))
37 if opts.library_dirs:
38 result.append(sysconfig.get_config_var('BINLIBDEST'))
40 for x in result:
41 print x
43 if __name__ == '__main__':
44 main()