[New-bugs-announce] [issue11602] python-config code should be in sysconfig

Antoine Pitrou report at bugs.python.org
Fri Mar 18 20:11:18 CET 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

python-config has the following non-trivial code for discovery of cflags/ldflags, which should be callable as a sysconfig API instead:

    elif opt in ('--includes', '--cflags'):
        flags = ['-I' + sysconfig.get_path('include'),
                 '-I' + sysconfig.get_path('platinclude')]
        if opt == '--cflags':
            flags.extend(getvar('CFLAGS').split())
        print(' '.join(flags))

    elif opt in ('--libs', '--ldflags'):
        libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
        libs.append('-lpython' + pyver + sys.abiflags)
        # add the prefix/lib/pythonX.Y/config dir, but only if there is no
        # shared library in prefix/lib/.
        if opt == '--ldflags':
            if not getvar('Py_ENABLE_SHARED'):
                libs.insert(0, '-L' + getvar('LIBPL'))
            libs.extend(getvar('LINKFORSHARED').split())
        print(' '.join(libs))


Also, it begs the question why distutils doesn't use the same code in its compiler class, or even in customize_compiler()...

----------
assignee: tarek
components: Distutils
messages: 131357
nosy: eric.araujo, pitrou, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: python-config code should be in sysconfig
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11602>
_______________________________________


More information about the New-bugs-announce mailing list