Merge pull request #273060 from FedericoSchonborn/libpeas-pygobject3

libpeas, libpeas2: Fix Python loader
This commit is contained in:
Bobby Rong 2024-01-14 21:22:08 +08:00 committed by GitHub
commit 8ec878066c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 31 deletions

View File

@ -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/"
)
'';

View File

@ -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"
)

View File

@ -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+=(

View File

@ -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 {

View File

@ -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; {

View File

@ -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";

View File

@ -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; {

View File

@ -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 PyGObjects gi library available.
(substituteAll {
src = ./fix-paths.patch;
pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [
python3.pkgs.pygobject3
];
})
];
depsBuildBuild = [
pkg-config
];

View File

@ -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 PyGObjects 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 = [

View File

@ -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,