meson
meson copied to clipboard
import('python').find_installation('python2') accepts /usr/bin/pyton which is a Python 3
Describe the bug import('python').find_installation('python2') does not check that the interpreter is Python 2.
To Reproduce If there is "python" executable and no "python2" executable, then import('python').find_installation('python2') succeeds:
$ cat meson.build
project('foo')
summary({'version': import('python').find_installation('python2').language_version()})
$ meson setup --reconfigure /tmp/test
The Meson build system
Version: 0.64.0
Source dir: /tmp
Build dir: /tmp/test
Build type: native build
Project name: foo
Project version: undefined
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python found: YES (/usr/bin/python)
Build targets in project: 0
foo undefined
version: 3.11
Found ninja-1.11.1 at /usr/bin/ninja
In my system there are /usr/bin/python3 and /usr/bin/python, both Python 3, and no /usr/bin/python2.
Expected behavior
find_installation() should report and error. This as I understand a documentation:
If provided, it can be:
[...]
* One of python2 or python3: in either case, the module will try some alternative names: py -2 or py -3 on Windows, and python everywhere. In the latter case, it will check whether the version provided by the sysconfig module matches the required major version
There is a related issue #4608. But I think this is different bug. Especially the part "check whether the version [...] matches".
system parameters
- Native build
- Fedora 38
- Python 3.11
- meson 0.64.0
- ninja 1.11.1