Closed amcnulty-fermat closed 2 months ago
Meson should not react like this, but you don't need import('python').find_installation('python3')
to run a Python script. Using find_program('python3')
is enough and should work fine in a project()
call.
See also #11393 -- the linked PR should tag that issue as well.
There are various other issues that can cause an unhandled python exception, though they are crazier than importing a module and assuming it should work.
For example:
project('cargo lock', version: custom_target(output:'foo', command: ['echo']))
You might think this would be a type error since a custom_tgt isn't a valid input for this function. Instead you get AttributeError: 'NoneType' object has no attribute 'name'
because it first tries to create the target itself, and fails.
"obviously" I meant #5134 rather than linking back to this very ticket. :p sorry
Describe the bug Calling
import('python').find_installation('python3')
in the body ofproject()
causes an unhandled Python exception to be raised.To Reproduce The following
meson.build
definition can reproduce the exception on version1.0.0
Running
meson setup build
on this results in the following output:It's the invocation of the
find_installation()
method that results in the exception being raised. If I remove this invocation, then executemeson setup build
, meson produces the following output, which seems correct to me:Expected behavior Either Meson would correctly invoke the method on the Python module, or it would print an error message stating that invoking methods on submodules is not possible in this context.
System Parameters
meson --version
: 1.0.0, installed viapip3 install meson
ninja --version
: 1.10.1