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

Fix ninja bootstrap on macOS 12.3+ #900

Merged

Conversation

keith
Copy link
Member

@keith keith commented Apr 20, 2022

macOS 12.3 removed /usr/bin/python, which is what's currently in the
shebang of ninja's configure.py. This forces us to run this with python3
instead.

This can be removed if ninja-build/ninja#2118 is merged

macOS 12.3 removed /usr/bin/python, which is what's currently in the
shebang of ninja's configure.py. This forces us to run this with python3
instead.
Copy link
Member

@jsharpe jsharpe left a comment

Choose a reason for hiding this comment

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

This makes an assumption that python3 is available on the path which it might not be. Should we take a dependency on the python toolchain and grab the python binary to run from there instead?

@keith
Copy link
Member Author

keith commented Apr 20, 2022

Yes it does, I was kinda thinking since we were technically relying on py2 before as well it might be ok to just swap that to py3. But you're right that it would be better to solve that way. Do you know if there's prior art for that somewhere?

@jsharpe
Copy link
Member

jsharpe commented Apr 20, 2022

Hmm, I'm not sure there is prior art; I guess we'd need some way to convert a py_runtime_pair into something that returns platform_common.TemplateVariables that defines a PYTHON variable to be able to call the correct python but I don't know how to do that as the python toolchains is all native Java AFAIK and so I'm not sure how to extract the appropriate information in starlark (if its even currently possible).

Lets be pragmatic and go with the assumption that python3 is available on the path for now as we previously did for py2. I'll open another issue to track the fact that we should technically depend on a toolchain.

@jsharpe jsharpe merged commit f9458a5 into bazel-contrib:main Apr 20, 2022
@keith keith deleted the ks/fix-ninja-bootstrap-on-macos-12.3 branch April 21, 2022 16:43
@keith
Copy link
Member Author

keith commented Apr 21, 2022

I think we probably could do that, but I guess it would require the user setup something? since I don't think there's consistency around python setup like there is C++ 🤔

@jsharpe
Copy link
Member

jsharpe commented Apr 21, 2022

There is an autodetecting python toolchain AFAIK which searches the path for python / python3 and sets up a default toolchain but I've not looked at rules_python recently to know how/if that has changed at all. I use the dropbox rules to build the interpreter but that only works on linux at the moment.

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.

2 participants