You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/nanjekyejoannah'closed_at=Nonecreated_at=<Date2011-03-18.19:11:17.938>labels= ['type-bug', 'build', '3.11']
title='python-config code should be in sysconfig'updated_at=<Date2021-10-23.18:47:55.894>user='https://github.com/pitrou'
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()...
Activity
pitrou commentedon Mar 18, 2011
python-config has the following non-trivial code for discovery of cflags/ldflags, which should be callable as a sysconfig API instead:
Also, it begs the question why distutils doesn't use the same code in its compiler class, or even in customize_compiler()...
rhettinger commentedon Mar 18, 2011
+1
merwok commentedon Jun 18, 2011
+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.
Certainly because distutils pre-dates python-config. In packaging, we should certainly use sysconfig functions.
nanjekyejoannah commentedon Oct 23, 2021
@eric.araujo curious if you still have the interest to work on this. If not, I can help open a PR.
merwok commentedon Oct 23, 2021
I don’t have specific expertise in this, so please take it!
FFY00 commentedon Oct 23, 2021
I can help out, but would like to wait until we get a resolution in python/issues-test-cpython#25718 as it will likely conflict.
StanFromIreland commentedon Aug 17, 2025
Closing as duplicate of more recent issue, which has more up to date discussion.