History

add hg and python

cinap_lenrek committed 15 years ago

Commit 4bb9e221 parent 987265c3706 files · +1228772 −-233Browse files

Showing the changes to sys/src/cmd/python/Misc/python-config.in (1 of 3706 files). Show all

Unified · Split

sys/src/cmd/python/Misc/python-config.in+53−0
@@ -0,0 +1,53 @@
1#!@EXENAME@
2
3import sys
4import os
5import getopt
6from distutils import sysconfig
7
8valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
9 'ldflags', 'help']
10
11def 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
16try:
17 opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
18except getopt.error:
19 exit_with_usage()
20
21if not opts:
22 exit_with_usage()
23
24opt = opts[0][0]
25
26pyver = sysconfig.get_config_var('VERSION')
27getvar = sysconfig.get_config_var
28
29if opt == '--help':
30 exit_with_usage(0)
31
32elif opt == '--prefix':
33 print sysconfig.PREFIX
34
35elif opt == '--exec-prefix':
36 print sysconfig.EXEC_PREFIX
37
38elif 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
45elif 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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t