diff options
author | Aaron Andersen <aaron@fosslib.net> | 2021-07-20 19:58:09 -0400 |
---|---|---|
committer | Aaron Andersen <aaron@fosslib.net> | 2021-07-21 10:53:40 -0400 |
commit | acf6abcafcf0282cbc2ea85e10ce759e5203d445 (patch) | |
tree | d57de6481cf3bf5058241d9f8c26a6f010543e51 /pkgs/applications/video/kodi | |
parent | 20117e607d3dd91bef0136220e0056c0827e2854 (diff) |
kodi: set proper PYTHONPATH for addons
Diffstat (limited to 'pkgs/applications/video/kodi')
-rw-r--r-- | pkgs/applications/video/kodi/wrapper.nix | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pkgs/applications/video/kodi/wrapper.nix b/pkgs/applications/video/kodi/wrapper.nix index 86164682138d8..7377e638676eb 100644 --- a/pkgs/applications/video/kodi/wrapper.nix +++ b/pkgs/applications/video/kodi/wrapper.nix @@ -1,8 +1,19 @@ -{ lib, makeWrapper, buildEnv, kodi, addons }: +{ lib, makeWrapper, buildEnv, kodi, addons, callPackage }: let + kodiPackages = callPackage ../../../top-level/kodi-packages.nix { inherit kodi; }; + # linux distros are supposed to provide pillow and pycryptodome - requiredPythonPackages = with kodi.pythonPackages; [ pillow pycryptodome] ++ addons; + requiredPythonPath = with kodi.pythonPackages; makePythonPath ([ pillow pycryptodome ]); + + # each kodi addon can potentially export a python module which should be included in PYTHONPATH + # see any addon which supplies `passthru.pythonPath` and the corresponding entry in the addons `addon.xml` + # eg. `<extension point="xbmc.python.module" library="lib" />` -> pythonPath = "lib"; + additionalPythonPath = + let + addonsWithPythonPath = lib.filter (addon: addon ? pythonPath) addons; + in + lib.concatMapStringsSep ":" (addon: "${addon}${kodiPackages.addonDir}/${addon.namespace}/${addon.pythonPath}") addonsWithPythonPath; in buildEnv { @@ -18,7 +29,7 @@ buildEnv { for exe in kodi{,-standalone} do makeWrapper ${kodi}/bin/$exe $out/bin/$exe \ - --prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath requiredPythonPackages} \ + --prefix PYTHONPATH : ${requiredPythonPath}:${additionalPythonPath} \ --prefix KODI_HOME : $out/share/kodi \ --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath (lib.concatMap |