mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Make python-config support multiple option flags on the same command line, rather than requiring one invocation per flag.
This commit is contained in:
parent
00dd3f51bc
commit
a70f349620
2 changed files with 29 additions and 24 deletions
|
@ -82,6 +82,8 @@ Tools/Demos
|
|||
measures the number of UDP packets processed per second depending on the
|
||||
number of background CPU-bound Python threads.
|
||||
|
||||
- python-config now supports multiple options on the same command line.
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
|
|
|
@ -21,15 +21,16 @@ except getopt.error:
|
|||
if not opts:
|
||||
exit_with_usage()
|
||||
|
||||
opt = opts[0][0]
|
||||
|
||||
pyver = sysconfig.get_config_var('VERSION')
|
||||
getvar = sysconfig.get_config_var
|
||||
|
||||
if opt == '--help':
|
||||
exit_with_usage(0)
|
||||
opt_flags = [flag for (flag, val) in opts]
|
||||
|
||||
elif opt == '--prefix':
|
||||
if '--help' in opt_flags:
|
||||
exit_with_usage(code=0)
|
||||
|
||||
for opt in opt_flags:
|
||||
if opt == '--prefix':
|
||||
print sysconfig.PREFIX
|
||||
|
||||
elif opt == '--exec-prefix':
|
||||
|
@ -47,7 +48,9 @@ elif opt in ('--libs', '--ldflags'):
|
|||
libs.append('-lpython'+pyver)
|
||||
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
|
||||
# shared library in prefix/lib/.
|
||||
if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
|
||||
if opt == '--ldflags':
|
||||
if not getvar('Py_ENABLE_SHARED'):
|
||||
libs.insert(0, '-L' + getvar('LIBPL'))
|
||||
libs.extend(getvar('LINKFORSHARED').split())
|
||||
print ' '.join(libs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue