From 4422e611fe76cd1d692e3d9122b7249924ae713f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 01:11:16 -0300 Subject: [PATCH 1/9] libpeas: Fix Python loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/development/libraries/libpeas/default.nix | 13 +++++++++++++ pkgs/development/libraries/libpeas/fix-paths.patch | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/development/libraries/libpeas/fix-paths.patch diff --git a/pkgs/development/libraries/libpeas/default.nix b/pkgs/development/libraries/libpeas/default.nix index 70d33d86ad19..f0b6023117d9 100644 --- a/pkgs/development/libraries/libpeas/default.nix +++ b/pkgs/development/libraries/libpeas/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchurl +, substituteAll , meson , ninja , pkg-config @@ -12,6 +13,7 @@ , gobject-introspection , python3 , ncurses +, wrapGAppsHook }: stdenv.mkDerivation rec { @@ -25,6 +27,16 @@ stdenv.mkDerivation rec { sha256 = "KXy5wszNjoYXYj0aPoQVtFMLjlqJPjUnu/0e3RMje0w="; }; + patches = [ + # Make PyGObject’s gi library available. + (substituteAll { + src = ./fix-paths.patch; + pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ + python3.pkgs.pygobject3 + ]; + }) + ]; + depsBuildBuild = [ pkg-config ]; @@ -36,6 +48,7 @@ stdenv.mkDerivation rec { gettext gi-docgen gobject-introspection + wrapGAppsHook ]; buildInputs = [ diff --git a/pkgs/development/libraries/libpeas/fix-paths.patch b/pkgs/development/libraries/libpeas/fix-paths.patch new file mode 100644 index 000000000000..c54cdd8873f5 --- /dev/null +++ b/pkgs/development/libraries/libpeas/fix-paths.patch @@ -0,0 +1,14 @@ +diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c +index 26edbf3..0d65ada 100644 +--- a/loaders/python/peas-plugin-loader-python.c ++++ b/loaders/python/peas-plugin-loader-python.c +@@ -248,6 +248,9 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader) + goto python_init_error; + } + ++ /* Add PyGObject to path */ ++ PyRun_SimpleString("import site; import functools; functools.reduce(lambda k, p: site.addsitedir(p, k), [@pythonPaths@], site._init_pathinfo())"); ++ + /* Initialize PyGObject */ + pygobject_init (PYGOBJECT_MAJOR_VERSION, + PYGOBJECT_MINOR_VERSION, From a474fb8826bbe2e874a7e7bed64fb233a348bd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 01:11:31 -0300 Subject: [PATCH 2/9] libpeas2: Fix Python loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/development/libraries/libpeas/2.x.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/libraries/libpeas/2.x.nix b/pkgs/development/libraries/libpeas/2.x.nix index 547d7f5c27ef..38e4fe055085 100644 --- a/pkgs/development/libraries/libpeas/2.x.nix +++ b/pkgs/development/libraries/libpeas/2.x.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchurl +, substituteAll , pkg-config , gi-docgen , gobject-introspection @@ -25,6 +26,16 @@ stdenv.mkDerivation rec { hash = "sha256-ndwdUfOGY9pN9SFjBRt7LOo6JCz67p9afhQPB4TIqnc="; }; + patches = [ + # Make PyGObject’s gi library available. + (substituteAll { + src = ./fix-paths.patch; + pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ + python3.pkgs.pygobject3 + ]; + }) + ]; + depsBuildBuild = [ pkg-config ]; From 678d82c7b567bcd2cb19883ee44a70d56b9cec8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 00:55:36 -0300 Subject: [PATCH 3/9] rhythmbox: Remove pygobject3 from PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/applications/audio/rhythmbox/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/audio/rhythmbox/default.nix b/pkgs/applications/audio/rhythmbox/default.nix index 394ccc3b723d..9929a32aabbf 100644 --- a/pkgs/applications/audio/rhythmbox/default.nix +++ b/pkgs/applications/audio/rhythmbox/default.nix @@ -101,7 +101,7 @@ stdenv.mkDerivation rec { preFixup = '' gappsWrapperArgs+=( - --prefix PYTHONPATH : "${python3.pkgs.pygobject3}/${python3.sitePackages}:$out/lib/rhythmbox/plugins/" + --prefix PYTHONPATH : "$out/lib/rhythmbox/plugins/" ) ''; From 6faa06862f2660d1e46020c5e1575c97f71f0650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 00:56:05 -0300 Subject: [PATCH 4/9] gnome-builder: Do not set PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/applications/editors/gnome-builder/default.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkgs/applications/editors/gnome-builder/default.nix b/pkgs/applications/editors/gnome-builder/default.nix index fc3f3fd27474..da36d5f111f7 100644 --- a/pkgs/applications/editors/gnome-builder/default.nix +++ b/pkgs/applications/editors/gnome-builder/default.nix @@ -73,7 +73,6 @@ stdenv.mkDerivation rec { ninja pkg-config python3 - python3.pkgs.wrapPython wrapGAppsHook4 ]; @@ -137,12 +136,8 @@ stdenv.mkDerivation rec { meson test --print-errorlogs ''; - pythonPath = with python3.pkgs; requiredPythonModules [ pygobject3 ]; - preFixup = '' - buildPythonPath "$out $pythonPath" gappsWrapperArgs+=( - --prefix PYTHONPATH : "$program_PYTHONPATH" # For sysprof-agent --prefix PATH : "${sysprof}/bin" ) From 8bb04333fabd283695173e941feb6ccadbad3555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 00:57:05 -0300 Subject: [PATCH 5/9] astroid: Remove pygobject3 from PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/applications/networking/mailreaders/astroid/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/mailreaders/astroid/default.nix b/pkgs/applications/networking/mailreaders/astroid/default.nix index 739f45fd4ee9..518d47a9a40a 100644 --- a/pkgs/applications/networking/mailreaders/astroid/default.nix +++ b/pkgs/applications/networking/mailreaders/astroid/default.nix @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { sed -i "s~ -geom 10x10~~g" src/config.cc ''; - pythonPath = with python3.pkgs; requiredPythonModules [ pygobject3 ] ++ extraPythonPackages; + pythonPath = with python3.pkgs; requiredPythonModules extraPythonPackages; preFixup = '' buildPythonPath "$out $pythonPath" gappsWrapperArgs+=( From 9172370874a4cfbfdc676c5ffd619aa341a41335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 00:57:35 -0300 Subject: [PATCH 6/9] liferea: Do not set PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- .../networking/newsreaders/liferea/default.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix index d7643a6f07e8..0851d0f30e79 100644 --- a/pkgs/applications/networking/newsreaders/liferea/default.nix +++ b/pkgs/applications/networking/newsreaders/liferea/default.nix @@ -73,14 +73,9 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - pythonPath = with python3Packages; [ - pygobject3 - pycairo - ]; - - preFixup = '' - buildPythonPath "$out $pythonPath" - gappsWrapperArgs+=(--prefix PYTHONPATH : "$program_PYTHONPATH") + postFixup = '' + buildPythonPath ${python3Packages.pycairo} + patchPythonScript $out/lib/liferea/plugins/trayicon.py ''; passthru.updateScript = gitUpdater { From 0729a314c54a5fe16df8114dd33e1910aff50de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 00:59:00 -0300 Subject: [PATCH 7/9] xplayer: Patch dbus-python into plugin directly, remove pythonenv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/applications/video/xplayer/default.nix | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/video/xplayer/default.nix b/pkgs/applications/video/xplayer/default.nix index 20a9772021a9..baa8fcb95be0 100644 --- a/pkgs/applications/video/xplayer/default.nix +++ b/pkgs/applications/video/xplayer/default.nix @@ -25,13 +25,6 @@ , xapp , yelp-tools }: -let - pythonenv = python3.withPackages (ps: [ - ps.pygobject3 - ps.dbus-python # For one plugin - ]); -in - stdenv.mkDerivation rec { pname = "xplayer"; version = "2.4.4"; @@ -66,6 +59,7 @@ stdenv.mkDerivation rec { intltool itstool pkg-config + python3.pkgs.wrapPython yelp-tools gobject-introspection ]; @@ -82,15 +76,15 @@ stdenv.mkDerivation rec { libpeas libxml2 libxplayer-plparser - pythonenv + python3 xapp # to satisfy configure script - pythonenv.pkgs.pygobject3 + python3.pkgs.pygobject3 ]; - postInstall = '' - wrapProgram $out/bin/xplayer \ - --prefix PATH : ${lib.makeBinPath [ pythonenv ]} + postFixup = '' + buildPythonPath ${python3.pkgs.dbus-python} + patchPythonScript $out/lib/xplayer/plugins/dbus/dbusservice.py ''; meta = with lib; { From 3a50e0e6cba81bca08cb203aee56a42f4db31d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 01:00:24 -0300 Subject: [PATCH 8/9] gnome.totem: Do not set PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/desktops/gnome/core/totem/default.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/desktops/gnome/core/totem/default.nix b/pkgs/desktops/gnome/core/totem/default.nix index 24c637909a32..1f6755002f01 100644 --- a/pkgs/desktops/gnome/core/totem/default.nix +++ b/pkgs/desktops/gnome/core/totem/default.nix @@ -91,9 +91,7 @@ stdenv.mkDerivation rec { adwaita-icon-theme gnome-desktop gsettings-desktop-schemas - # for plug-ins python3Packages.pygobject3 - python3Packages.dbus-python ]; nativeCheckInputs = [ @@ -124,8 +122,6 @@ stdenv.mkDerivation rec { runHook postCheck ''; - wrapPrefixVariables = [ "PYTHONPATH" ]; - passthru = { updateScript = gnome.updateScript { packageName = "totem"; From 9d7136ff2abdc93000fe6070e4969dfc02379ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Dami=C3=A1n=20Schonborn?= Date: Sat, 9 Dec 2023 01:00:48 -0300 Subject: [PATCH 9/9] mate.pluma: Patch missing dependencies for plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Federico Damián Schonborn --- pkgs/desktops/mate/pluma/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/desktops/mate/pluma/default.nix b/pkgs/desktops/mate/pluma/default.nix index 665e1b49a436..ed7d54e9469b 100644 --- a/pkgs/desktops/mate/pluma/default.nix +++ b/pkgs/desktops/mate/pluma/default.nix @@ -32,6 +32,7 @@ stdenv.mkDerivation rec { itstool perl pkg-config + python3.pkgs.wrapPython wrapGAppsHook ]; @@ -47,6 +48,16 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + pythonPath = with python3.pkgs; [ + pycairo + six + ]; + + postFixup = '' + buildPythonPath "$pythonPath" + patchPythonScript $out/lib/pluma/plugins/snippets/Snippet.py + ''; + passthru.updateScript = mateUpdateScript { inherit pname; }; meta = with lib; {