~ubuntu-branches/ubuntu/natty/ibus-m17n/natty

« back to all changes in this revision

Viewing changes to python-config.py

  • Committer: Bazaar Package Importer
  • Author(s): LI Daobing
  • Date: 2009-05-01 14:27:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090501142755-06oogjh89lgvui6c
Tags: 1.1.0.20090211-0ubuntu1
* new upstream release (LP: #370212)
  - no longer depends on python.
* debian/control: 
  - build depends on libibus-dev.
  - change maintainer's email.
  - bump standards version to 3.8.1.
  - remove swig, python-dev and python-support from build-depends.
* debian/rules:
  - add "-Wl,--as-needed" to LDFLAGS.
  - remove dh_pysupport.

Show diffs side-by-side

added added

removed removed

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