Merge pull request #142824 from jtojnar/nautilus-python

gnome.nautilus-python: fix loading gi
This commit is contained in:
Jan Tojnar 2021-10-30 01:56:28 +02:00 committed by GitHub
commit 39423b9f03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -1,4 +1,6 @@
{ lib, stdenv
{ stdenv
, lib
, substituteAll
, fetchurl
, pkg-config
, which
@ -23,6 +25,16 @@ stdenv.mkDerivation rec {
sha256 = "161050sx3sdxqcpjkjcpf6wl4kx0jydihga7mcvrj9c2f8ly0g07";
};
patches = [
# Make PyGObjects gi library available.
(substituteAll {
src = ./fix-paths.patch;
pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [
python3.pkgs.pygobject3
];
})
];
nativeBuildInputs = [
pkg-config
which

View file

@ -0,0 +1,14 @@
diff --git a/src/nautilus-python.c b/src/nautilus-python.c
index 843e3c6..466a513 100644
--- a/src/nautilus-python.c
+++ b/src/nautilus-python.c
@@ -184,6 +184,9 @@ nautilus_python_init_python (void) {
return FALSE;
}
+ debug("Add PyGObject to path");
+ PyRun_SimpleString("import site;import functools; functools.reduce(lambda k, p: site.addsitedir(p, k), [@pythonPaths@], site._init_pathinfo())");
+
/* import gobject */
debug("init_pygobject");
if (!np_init_pygobject()) {