diff options
| author | Charles Brunet <charles.brunet@optelgroup.com> | 2024-02-08 10:15:37 -0500 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-02-19 21:52:09 +0200 |
| commit | b290a8254122f53d6477b7ba24366d81cfc5e99c (patch) | |
| tree | 920bcdb68784a262736d387dbe38935d7df3c52f /test cases/python | |
| parent | 43fe0061902f9d204eeeb8d4fef779480ec5487c (diff) | |
| download | meson-b290a8254122f53d6477b7ba24366d81cfc5e99c.tar.gz | |
Fix KeyError in Python module
0e7fb07 introduced a subtile bug in the Python module.
If a python version is found, but is missing a required module,
it is added to the list of python installations, but the
`run_bytecompile` attribute for that version was not initialized.
Therefore, if any other python version added something to install, it
was raising a KeyError when trying to read the `run_bytecompile`
attribute for the python version with missing module.
Diffstat (limited to 'test cases/python')
| -rw-r--r-- | test cases/python/5 modules kwarg/a.py | 0 | ||||
| -rw-r--r-- | test cases/python/5 modules kwarg/meson.build | 16 | ||||
| -rw-r--r-- | test cases/python/5 modules kwarg/test.json | 5 |
3 files changed, 19 insertions, 2 deletions
diff --git a/test cases/python/5 modules kwarg/a.py b/test cases/python/5 modules kwarg/a.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test cases/python/5 modules kwarg/a.py diff --git a/test cases/python/5 modules kwarg/meson.build b/test cases/python/5 modules kwarg/meson.build index 41a9a4fae..6e745ba62 100644 --- a/test cases/python/5 modules kwarg/meson.build +++ b/test cases/python/5 modules kwarg/meson.build @@ -1,7 +1,19 @@ -project('python kwarg') +project('python kwarg', + default_options: [ + 'python.bytecompile=-1', + 'python.purelibdir=/pure', + ] +) py = import('python') -prog_python = py.find_installation('python3', modules : ['os', 'sys', 're']) +prog_python = py.find_installation('python3', modules : ['os', 'sys', 're'], pure: true) assert(prog_python.found() == true, 'python not found when should be') + +# In meson 1.2 - 1.3.2, there was a bug when a python installation +# with a different version did not have a module, and we try to install +# something with another python version... +py.find_installation('python3.7', modules: ['notamodule'], required: false) +prog_python.install_sources('a.py') + prog_python = py.find_installation('python3', modules : ['thisbetternotexistmod'], required : false) assert(prog_python.found() == false, 'python not found but reported as found') diff --git a/test cases/python/5 modules kwarg/test.json b/test cases/python/5 modules kwarg/test.json new file mode 100644 index 000000000..cf874f102 --- /dev/null +++ b/test cases/python/5 modules kwarg/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + { "type": "python_file", "file": "pure/a.py"} + ] +}
\ No newline at end of file |
