Skip to content

python-config code should be in sysconfig #55811

Description

@pitrou
BPO 11602
Nosy @warsaw, @rhettinger, @pitrou, @ned-deily, @merwok, @cjrh, @nanjekyejoannah, @FFY00

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 = None
created_at = <Date 2011-03-18.19:11:17.938>
labels = ['type-bug', 'build', '3.11']
title = 'python-config code should be in sysconfig'
updated_at = <Date 2021-10-23.18:47:55.894>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2021-10-23.18:47:55.894>
actor = 'FFY00'
assignee = 'nanjekyejoannah'
closed = False
closed_date = None
closer = None
components = ['Build']
creation = <Date 2011-03-18.19:11:17.938>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 11602
keywords = []
message_count = 6.0
messages = ['131357', '131358', '138610', '404884', '404902', '404903']
nosy_count = 8.0
nosy_names = ['barry', 'rhettinger', 'pitrou', 'ned.deily', 'eric.araujo', 'cjrh', 'nanjekyejoannah', 'FFY00']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue11602'
versions = ['Python 3.11']

Activity

  1. pitrou commented on Mar 18, 2011

    @pitrou
    MemberAuthor

    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()...

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 18, 2011
  3. added
    type-bugAn unexpected behavior, bug, or error
    on Mar 18, 2011
  4. rhettinger commented on Mar 18, 2011

    @rhettinger
    Contributor

    +1

  5. merwok commented on Jun 18, 2011

    @merwok
    Member

    +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.

  6. added
    stdlibStandard Library Python modules in the Lib/ directory
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Jun 18, 2011
  7. assigned and unassigned on Jun 18, 2011
  8. nanjekyejoannah commented on Oct 23, 2021

    @nanjekyejoannah
    Contributor

    @eric.araujo curious if you still have the interest to work on this. If not, I can help open a PR.

  9. merwok commented on Oct 23, 2021

    @merwok
    Member

    I don’t have specific expertise in this, so please take it!

  10. added
    buildThe build process and cross-build
    3.11only security fixes
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 23, 2021
  11. FFY00 commented on Oct 23, 2021

    @FFY00
    Member

    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.

  12. transferred this issue fromon Apr 10, 2022
  13. StanFromIreland commented on Aug 17, 2025

    @StanFromIreland
    Member

    Closing as duplicate of more recent issue, which has more up to date discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.11only security fixesbuildThe build process and cross-buildtopic-sysconfigtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions