From 8dae0587686d1359ffd558fd64b1dfd783ded451 Mon Sep 17 00:00:00 2001 From: bvpav Date: Mon, 10 Apr 2023 21:12:56 +0200 Subject: [PATCH] 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 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 --- build_files/build_environment/install_linux_packages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/build_environment/install_linux_packages.py b/build_files/build_environment/install_linux_packages.py index 825157244b6..98eb0b11d0c 100755 --- a/build_files/build_environment/install_linux_packages.py +++ b/build_files/build_environment/install_linux_packages.py @@ -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"]]