`meson rewrite kwargs delete project / <option>` raises unhandled exception unless a dummy second value is passed
igo95862 opened this issue · comments
Describe the bug
meson rewrite kwargs delete project / <option>
raises unhandled exception unless a dummy second value is passed.
To Reproduce
Given following meson.build project() call:
project('bubblejail',
version : '0.8.3',
# Patch out these lines to install bubblejail's packages to site-packages
default_options : {
'python.purelibdir' : 'lib/bubblejail/python-packages',
'python.platlibdir' : 'lib/bubblejail/python-packages',
},
)
I tried to delete default_options
(and version
as a test) using meson rewrite:
meson rewrite kwargs delete project / default_options
meson rewrite kwargs delete project / version
This raises the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/mesonbuild/rewriter.py", line 997, in list_to_dict
result[i] = next(it)
^^^^^^^^
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/mesonbuild/mesonmain.py", line 186, in run
return options.run_func(options)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/mesonbuild/rewriter.py", line 1073, in run
raise e
File "/usr/lib/python3.12/site-packages/mesonbuild/rewriter.py", line 1059, in run
commands = cli_type_map[options.type](options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/mesonbuild/rewriter.py", line 1018, in generate_kwargs
'kwargs': list_to_dict(options.kwargs),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/mesonbuild/rewriter.py", line 999, in list_to_dict
raise TypeError('in_list parameter of list_to_dict must have an even length.')
TypeError: in_list parameter of list_to_dict must have an even length.
ERROR: Unhandled python exception
This is a Meson bug and should be reported!
I found a work-around with passing a second dummy value and it worked:
meson rewrite kwargs delete project / default_options ""
Expected behavior
meson rewrite removes the kwargs without dummy values.
system parameters
- Native build
- Arch Linux
- Python 3.12
- meson 1.4.0