cinnamon.nemo-python: init at 5.6.0
This commit is contained in:
parent
d5434a66e1
commit
25f506e942
|
@ -15,6 +15,7 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
# Extensions added here will be shipped by default
|
||||
nemoExtensions = [
|
||||
nemo-fileroller
|
||||
nemo-python
|
||||
];
|
||||
|
||||
# blueberry -> pkgs/tools/bluetooth/blueberry/default.nix
|
||||
|
@ -31,6 +32,7 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
cjs = callPackage ./cjs { };
|
||||
nemo = callPackage ./nemo { };
|
||||
nemo-fileroller = callPackage ./nemo-extensions/nemo-fileroller { };
|
||||
nemo-python = callPackage ./nemo-extensions/nemo-python { };
|
||||
nemo-with-extensions = callPackage ./nemo/wrapper.nix { };
|
||||
mint-artwork = callPackage ./mint-artwork { };
|
||||
mint-cursor-themes = callPackage ./mint-cursor-themes { };
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, meson
|
||||
, pkg-config
|
||||
, ninja
|
||||
, glib
|
||||
, gtk3
|
||||
, nemo
|
||||
, python3
|
||||
, substituteAll
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nemo-python";
|
||||
version = "5.6.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "linuxmint";
|
||||
repo = "nemo-extensions";
|
||||
rev = version;
|
||||
sha256 = "sha256-cxutiz5bc/dZ9D7XzvMWodWNYvNJPj+5IhJDPJwnb5I=";
|
||||
};
|
||||
|
||||
sourceRoot = "${src.name}/nemo-python";
|
||||
|
||||
patches = [
|
||||
# Load extensions from NEMO_PYTHON_EXTENSION_DIR environment variable
|
||||
# https://github.com/NixOS/nixpkgs/issues/78327
|
||||
./load-extensions-from-env.patch
|
||||
|
||||
# Required for pygobject_init ().
|
||||
(substituteAll {
|
||||
src = ./python-path.patch;
|
||||
env = "${python3.pkgs.pygobject3}/${python3.sitePackages}";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
pkg-config
|
||||
ninja
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
glib
|
||||
gtk3
|
||||
nemo
|
||||
python3
|
||||
python3.pkgs.pygobject3
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Tries to load libpython3.so via g_module_open ().
|
||||
substituteInPlace meson.build \
|
||||
--replace "get_option('prefix'), get_option('libdir')" "'${python3}/lib'"
|
||||
'';
|
||||
|
||||
PKG_CONFIG_LIBNEMO_EXTENSION_EXTENSIONDIR = "${placeholder "out"}/${nemo.extensiondir}";
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/linuxmint/nemo-extensions/tree/master/nemo-python";
|
||||
description = "Python bindings for the Nemo extension library";
|
||||
license = licenses.gpl2Plus;
|
||||
platforms = platforms.linux;
|
||||
maintainers = teams.cinnamon.members;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
diff --git a/src/nemo-python.c b/src/nemo-python.c
|
||||
index 8d2acdb..900811b 100644
|
||||
--- a/src/nemo-python.c
|
||||
+++ b/src/nemo-python.c
|
||||
@@ -255,6 +255,7 @@ nemo_module_initialize(GTypeModule *module)
|
||||
{
|
||||
gchar *user_extensions_dir;
|
||||
const gchar *env_string;
|
||||
+ const gchar *python_extensiondir;
|
||||
|
||||
env_string = g_getenv("NEMO_PYTHON_DEBUG");
|
||||
if (env_string != NULL)
|
||||
@@ -269,8 +270,12 @@ nemo_module_initialize(GTypeModule *module)
|
||||
|
||||
all_types = g_array_new(FALSE, FALSE, sizeof(GType));
|
||||
|
||||
- // Look in the new global path, $DATADIR/nemo-python/extensions
|
||||
- nemo_python_load_dir(module, PYTHON_EXTENSION_DIR);
|
||||
+ // Look in NEMO_PYTHON_EXTENSION_DIR
|
||||
+ python_extensiondir = g_getenv("NEMO_PYTHON_EXTENSION_DIR");
|
||||
+ if (python_extensiondir == NULL) {
|
||||
+ python_extensiondir = PYTHON_EXTENSION_DIR;
|
||||
+ }
|
||||
+ nemo_python_load_dir(module, python_extensiondir);
|
||||
|
||||
// Look in XDG_DATA_DIR, ~/.local/share/nemo-python/extensions
|
||||
user_extensions_dir = g_build_filename(g_get_user_data_dir(),
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/nemo-python.c b/src/nemo-python.c
|
||||
index 8d2acdb..ee24143 100644
|
||||
--- a/src/nemo-python.c
|
||||
+++ b/src/nemo-python.c
|
||||
@@ -197,7 +197,7 @@ nemo_python_init_python (void)
|
||||
}
|
||||
|
||||
debug("Sanitize the python search path");
|
||||
- PyRun_SimpleString("import sys; sys.path = [path for path in sys.path if path]");
|
||||
+ PyRun_SimpleString("import sys; sys.path = [path for path in sys.path if path]; sys.path.append('@env@')");
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
PyErr_Print();
|
|
@ -20,7 +20,8 @@ symlinkJoin {
|
|||
postBuild = ''
|
||||
for f in $(find $out/bin/ $out/libexec/ -type l -not -path "*/.*"); do
|
||||
wrapProgram "$f" \
|
||||
--set "NEMO_EXTENSION_DIR" "$out/${nemo.extensiondir}"
|
||||
--set "NEMO_EXTENSION_DIR" "$out/${nemo.extensiondir}" \
|
||||
--set "NEMO_PYTHON_EXTENSION_DIR" "$out/share/nemo-python/extensions"
|
||||
done
|
||||
|
||||
# Point to wrapped binary in all service files
|
||||
|
|
Loading…
Reference in a new issue