Skip to content

gh-93759: fix python-config.py generation in Makefile.pre.in #93760

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

Closed
wants to merge 2 commits into from

Conversation

ptsneves
Copy link
Contributor

BINDIR might be bigger than the max shebang size and lead to failures.
Let us assume we have python in the $PATH and let env resolve it.

BINDIR might be bigger than the max shebang size and lead to failures.
Let us assume we have python in the $PATH and let env resolve it
@ghost
Copy link

ghost commented Jun 13, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can neither safely assume that the interpreter is on PATH nor that the interpreter is installed as python3. It might be an altinstall that does not install the python3 alias.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ptsneves
Copy link
Contributor Author

ptsneves commented Jun 14, 2022

@tiran would a wrapper in bash that execs the script a viable alternative?

@tiran
Copy link
Member

tiran commented Jun 14, 2022

We already have a pure shell script version of python-config. Maybe we should retire python-config.py instead?

Comment on lines +2105 to +2107
@ # BINDIR might be bigger than the max shebang size and lead to failures. Let us assume we have
@ # python in the $PATH and let env resolve it
sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming "a python" is on PATH isn't good enough, python-config.py uses the sysconfig and reports values for the interpreter actually used.

The script should really be interpreted by the correct interpreter, even using "#!/usr/bin/env python3.11" wouldn't be good enough because a user may have multiple installs (for example both homebrew and anaconda).

@ronaldoussoren
Copy link
Contributor

We already have a pure shell script version of python-config. Maybe we should retire python-config.py instead?

The python version is only used for macOS because the pure shell script version is broken there, in particular it doesn't apply the finetuning for CFLAGS/LDFLAGS/.... that's performed by _osx_support.py. It might be possible to drop that finetuning, but that requires someone to actually do the work and test it.

@erlend-aasland
Copy link
Contributor

Sounds to me like this PR and its issue can be closed as wont-fix or invalid?

@ptsneves
Copy link
Contributor Author

oki please close as wont fix. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

python-config.py fails if bindir is too long due to shebang overflow
6 participants