OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [python/] [python-config.py] - Blame information for rev 330

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Program to fetch python compilation parameters.
2
# Copied from python-config of the 2.6.5 release.
3
 
4
import sys
5
import os
6
import getopt
7
from distutils import sysconfig
8
 
9
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
10
              'ldflags', 'help']
11
 
12
def exit_with_usage(code=1):
13
    print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0],
14
                                            '|'.join('--'+opt for opt in valid_opts))
15
    sys.exit(code)
16
 
17
try:
18
    opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
19
except getopt.error:
20
    exit_with_usage()
21
 
22
if not opts:
23
    exit_with_usage()
24
 
25
opt = opts[0][0]
26
 
27
pyver = sysconfig.get_config_var('VERSION')
28
getvar = sysconfig.get_config_var
29
 
30
if opt == '--help':
31
    exit_with_usage(0)
32
 
33
elif opt == '--prefix':
34
    print sysconfig.PREFIX
35
 
36
elif opt == '--exec-prefix':
37
    print sysconfig.EXEC_PREFIX
38
 
39
elif opt in ('--includes', '--cflags'):
40
    flags = ['-I' + sysconfig.get_python_inc(),
41
             '-I' + sysconfig.get_python_inc(plat_specific=True)]
42
    if opt == '--cflags':
43
        flags.extend(getvar('CFLAGS').split())
44
    print ' '.join(flags)
45
 
46
elif opt in ('--libs', '--ldflags'):
47
    libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
48
    libs.append('-lpython'+pyver)
49
    # add the prefix/lib/pythonX.Y/config dir, but only if there is no
50
    # shared library in prefix/lib/.
51
    if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
52
        libs.insert(0, '-L' + getvar('LIBPL'))
53
    print ' '.join(libs)
54
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.