Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-config code should be in sysconfig #55811

Open
pitrou opened this issue Mar 18, 2011 · 6 comments
Open

python-config code should be in sysconfig #55811

pitrou opened this issue Mar 18, 2011 · 6 comments
Assignees
Labels
3.11 only security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Mar 18, 2011

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']

@pitrou
Copy link
Member Author

pitrou commented 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:

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

@pitrou pitrou added the stdlib Python modules in the Lib dir label Mar 18, 2011
@pitrou pitrou added the type-bug An unexpected behavior, bug, or error label Mar 18, 2011
@rhettinger
Copy link
Contributor

+1

@merwok
Copy link
Member

merwok commented 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.

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.

@merwok merwok added stdlib Python modules in the Lib dir and removed stdlib Python modules in the Lib dir labels Jun 18, 2011
@merwok merwok assigned merwok and unassigned tarekziade Jun 18, 2011
@nanjekyejoannah
Copy link
Member

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

@merwok
Copy link
Member

merwok commented Oct 23, 2021

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

@merwok merwok added build The build process and cross-build 3.11 only security fixes and removed stdlib Python modules in the Lib dir labels Oct 23, 2021
@merwok merwok assigned nanjekyejoannah and unassigned merwok Oct 23, 2021
@FFY00
Copy link
Member

FFY00 commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants