On Gentoo, the shebang of `ansible-playbook` is the python-exec
dispatcher (`#!/usr/bin/python-exec2c`), which bin/ansible-python.sh
took for an interpreter, because its name starts with `python`.
python-exec only runs the programs it wraps, so every `just run…`
recipe failed with "no python-exec wrapped executable found".
Now only names like `python`, `python3` or `python3.14` are trusted.
For anything else (python-exec, wrapper scripts as on Nix), Ansible is
asked which interpreter it runs on (`ansible-playbook --version`),
before falling back to `python3`, which may lack PyYAML (e.g. in an
active virtualenv).
Same as https://github.com/mother-of-all-self-hosting/mash-playbook/commit/a685940a
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bin/ansible-python.sh runs Python with the interpreter named in the
first line of `ansible-playbook`. That interpreter has PyYAML, since
Ansible depends on it, even when Ansible is installed in an environment
of its own (e.g. with pipx), where the system's `python3` may lack it.
If it is not a Python interpreter (e.g. `ansible-playbook` is a wrapper
script), or Ansible is missing, `python3` is used.
Role installation, which needs PyYAML, is the first to use it in the
next commit, so that it works without installing PyYAML separately.
The same script in mash-playbook (where its tests live):
https://github.com/mother-of-all-self-hosting/mash-playbook/commit/1fe0f90f
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>