Index: gdb/python/python-config.py |
diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py |
index 75ed2d2183eab8c5ef14b02b396cb0f0fc704a2d..c2b2969c3923bb4abc288cf56f70c3393eb3c12f 100644 |
--- a/gdb/python/python-config.py |
+++ b/gdb/python/python-config.py |
@@ -10,8 +10,8 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', |
'ldflags', 'help'] |
def exit_with_usage(code=1): |
- print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], |
- '|'.join('--'+opt for opt in valid_opts)) |
+ sys.stderr.write ("Usage: %s [%s]\n" % (sys.argv[0], |
+ '|'.join('--'+opt for opt in valid_opts))) |
sys.exit(code) |
try: |
@@ -24,6 +24,7 @@ if not opts: |
pyver = sysconfig.get_config_var('VERSION') |
getvar = sysconfig.get_config_var |
+abiflags = getattr (sys, "abiflags", "") |
opt_flags = [flag for (flag, val) in opts] |
@@ -44,17 +45,17 @@ def to_unix_path(path): |
for opt in opt_flags: |
if opt == '--prefix': |
- print to_unix_path(sysconfig.PREFIX) |
+ print (to_unix_path(sysconfig.PREFIX)) |
elif opt == '--exec-prefix': |
- print to_unix_path(sysconfig.EXEC_PREFIX) |
+ print (to_unix_path(sysconfig.EXEC_PREFIX)) |
elif opt in ('--includes', '--cflags'): |
flags = ['-I' + sysconfig.get_python_inc(), |
'-I' + sysconfig.get_python_inc(plat_specific=True)] |
if opt == '--cflags': |
flags.extend(getvar('CFLAGS').split()) |
- print to_unix_path(' '.join(flags)) |
+ print (to_unix_path(' '.join(flags))) |
elif opt in ('--libs', '--ldflags'): |
libs = [] |
@@ -62,7 +63,7 @@ for opt in opt_flags: |
libs.extend(getvar('LIBS').split()) |
if getvar('SYSLIBS') is not None: |
libs.extend(getvar('SYSLIBS').split()) |
- libs.append('-lpython'+pyver) |
+ libs.append('-lpython'+pyver + abiflags) |
# add the prefix/lib/pythonX.Y/config dir, but only if there is no |
# shared library in prefix/lib/. |
if opt == '--ldflags': |
@@ -73,5 +74,5 @@ for opt in opt_flags: |
libs.insert(0, '-L' + sysconfig.PREFIX + '/libs') |
if getvar('LINKFORSHARED') is not None: |
libs.extend(getvar('LINKFORSHARED').split()) |
- print to_unix_path(' '.join(libs)) |
+ print (to_unix_path(' '.join(libs))) |