Fix: Crash in install_linux_packages.py script
There is a `KeyError` exception when the `install_linux_packages.py` build script is ran with `--distro-id`:
```console
$ ./build_files/build_environment/install_linux_packages.py --distro-id arch
INFO: Distribution identifier forced by user to arch.
Traceback (most recent call last):
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1656, in <module>
main()
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1646, in main
distro_package_installer = PackageInstaller(settings) if settings.show_deps else get_distro_package_installer(settings)
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1570, in get_distro_package_installer
return DISTRO_IDS_INSTALLERS[get_distro(settings)](settings)
KeyError: None
```
This happens because the `get_distro` function returns `None` if the distribution ID is forced with the `--distro-id` option, when it should return the provided value.
Pull Request: https://projects.blender.org/blender/blender/pulls/106461
This commit is contained in:
@@ -1628,7 +1628,7 @@ DISTRO_IDS_INSTALLERS = {
|
||||
def get_distro(settings):
|
||||
if settings.distro_id is not ...:
|
||||
settings.logger.info(f"Distribution identifier forced by user to {settings.distro_id}.")
|
||||
return
|
||||
return settings.distro_id
|
||||
import platform
|
||||
info = platform.freedesktop_os_release()
|
||||
ids = [info["ID"]]
|
||||
|
||||
Reference in New Issue
Block a user