This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: python-config code should be in sysconfig
Type: behavior Stage: needs patch
Components: Build Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: nanjekyejoannah Nosy List: FFY00, barry, cjrh, eric.araujo, nanjekyejoannah, ned.deily, pitrou, rhettinger
Priority: normal Keywords:

Created on 2011-03-18 19:11 by pitrou, last changed 2022-04-11 14:57 by admin.

Messages (6)
msg131357 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-03-18 19:11
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()...
msg131358 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-03-18 19:28
+1
msg138610 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-18 21:47
+1 on the request.  I don’t think it can go in 3.2, though.  I’ll propose a patch, this will let me learn more about the flags.

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

Certainly because distutils pre-dates python-config.  In packaging, we should certainly use sysconfig functions.
msg404884 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2021-10-23 15:32
@eric.araujo curious if you still have the interest to work on this. If not, I can help open a PR.
msg404902 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2021-10-23 18:45
I don’t have specific expertise in this, so please take it!
msg404903 - (view) Author: Filipe Laíns (FFY00) * (Python triager) Date: 2021-10-23 18:47
I can help out, but would like to wait until we get a resolution in GH-25718 as it will likely conflict.
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55811
2021-10-23 18:47:55FFY00setmessages: + msg404903
2021-10-23 18:45:53eric.araujosetversions: + Python 3.11, - Python 3.3
nosy: - tarek, alexis

messages: + msg404902

assignee: eric.araujo -> nanjekyejoannah
components: + Build, - Library (Lib), Distutils2
2021-10-23 16:46:11FFY00setnosy: + FFY00
2021-10-23 15:32:41nanjekyejoannahsetmessages: + msg404884
2019-07-26 22:10:21nanjekyejoannahsetnosy: + nanjekyejoannah
2016-08-20 05:39:20cjrhsetnosy: + cjrh
2012-07-26 23:23:57ned.deilysetnosy: + ned.deily
2012-07-26 15:38:55barrysetnosy: + barry
2011-06-18 21:47:46eric.araujosetassignee: tarek -> eric.araujo
2011-06-18 21:47:36eric.araujosetversions: - Python 3.2
nosy: + alexis

messages: + msg138610

components: + Library (Lib), Distutils2, - Distutils
2011-03-18 19:28:51rhettingersetnosy: + rhettinger
messages: + msg131358
2011-03-18 19:11:17pitroucreate