Skip to content

Fix Python Binary Command Being Truncated to the First Element - #16045

Open
Alvaro-Kothe wants to merge 1 commit into
mesonbuild:masterfrom
Alvaro-Kothe:fix/python-introspect
Open

Fix Python Binary Command Being Truncated to the First Element#16045
Alvaro-Kothe wants to merge 1 commit into
mesonbuild:masterfrom
Alvaro-Kothe:fix/python-introspect

Conversation

@Alvaro-Kothe

@Alvaro-Kothe Alvaro-Kothe commented Jul 30, 2026

Copy link
Copy Markdown

This patch basically adapts _find_installation_impl to handle a list for the name_or_path argument.


On master using /usr/bin/env, meson setup passes when providing a wrong command, e.g.

python = ['/usr/bin/env', 'this-command-doesnt-exist']

meson setup prints Program python found: YES (/usr/bin/env).

With this patch it fails with

meson.build:3:22: ERROR: <PythonExternalProgram 'python' -> ['/usr/bin/env', 'this-command-doesnt-exist']> is not a valid python or it is missing distutils

The other case that it failed on master was running python through qemu

cross.ini

[binaries]
python = ['qemu-aarch64-static', '-L', '/home/alvaro/aarch64-root', '/home/alvaro/aarch64-root/usr/bin/python3.14']

which fails with

meson.build:3:22: ERROR: <PythonExternalProgram 'python' -> ['/usr/bin/qemu-aarch64-static']> is not a valid python or it is missing distutils

while with this patch it passes and creates the correct suffix for the python target

build foo.cpython-314-aarch64-linux-gnu.so: c_LINKER foo.cpython-314-aarch64-linux-gnu.so.p/meson-generated_foo.pyx.c.o

Closes #15985

@Alvaro-Kothe
Alvaro-Kothe requested a review from jpakkane as a code owner July 30, 2026 02:38
@Alvaro-Kothe
Alvaro-Kothe marked this pull request as draft July 30, 2026 16:00
@Alvaro-Kothe

Copy link
Copy Markdown
Author

I will leave this into draft mode while I fix the CI errors.

Improves behavior to allow specifying a command sequence for python
binary in native files.
@Alvaro-Kothe
Alvaro-Kothe force-pushed the fix/python-introspect branch from 12ec87e to 3ce19cf Compare August 1, 2026 02:49
@Alvaro-Kothe Alvaro-Kothe changed the title Fix Python Binary Truncating Command to First Element Fix Python Binary Command Being Truncated to the First Element Aug 1, 2026
@Alvaro-Kothe
Alvaro-Kothe marked this pull request as ready for review August 1, 2026 03:04
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.

Introspect Failure for Python with Custom Command in Cross Compilaiton

1 participant