Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

cinnamon.nemo-python: init at 5.6.0

+112 -1
+2
pkgs/desktops/cinnamon/default.nix
··· 15 15 # Extensions added here will be shipped by default 16 16 nemoExtensions = [ 17 17 nemo-fileroller 18 + nemo-python 18 19 ]; 19 20 20 21 # blueberry -> pkgs/tools/bluetooth/blueberry/default.nix ··· 31 32 cjs = callPackage ./cjs { }; 32 33 nemo = callPackage ./nemo { }; 33 34 nemo-fileroller = callPackage ./nemo-extensions/nemo-fileroller { }; 35 + nemo-python = callPackage ./nemo-extensions/nemo-python { }; 34 36 nemo-with-extensions = callPackage ./nemo/wrapper.nix { }; 35 37 mint-artwork = callPackage ./mint-artwork { }; 36 38 mint-cursor-themes = callPackage ./mint-cursor-themes { };
+68
pkgs/desktops/cinnamon/nemo-extensions/nemo-python/default.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , meson 5 + , pkg-config 6 + , ninja 7 + , glib 8 + , gtk3 9 + , nemo 10 + , python3 11 + , substituteAll 12 + }: 13 + 14 + stdenv.mkDerivation rec { 15 + pname = "nemo-python"; 16 + version = "5.6.0"; 17 + 18 + src = fetchFromGitHub { 19 + owner = "linuxmint"; 20 + repo = "nemo-extensions"; 21 + rev = version; 22 + sha256 = "sha256-cxutiz5bc/dZ9D7XzvMWodWNYvNJPj+5IhJDPJwnb5I="; 23 + }; 24 + 25 + sourceRoot = "${src.name}/nemo-python"; 26 + 27 + patches = [ 28 + # Load extensions from NEMO_PYTHON_EXTENSION_DIR environment variable 29 + # https://github.com/NixOS/nixpkgs/issues/78327 30 + ./load-extensions-from-env.patch 31 + 32 + # Required for pygobject_init (). 33 + (substituteAll { 34 + src = ./python-path.patch; 35 + env = "${python3.pkgs.pygobject3}/${python3.sitePackages}"; 36 + }) 37 + ]; 38 + 39 + nativeBuildInputs = [ 40 + meson 41 + pkg-config 42 + ninja 43 + ]; 44 + 45 + buildInputs = [ 46 + glib 47 + gtk3 48 + nemo 49 + python3 50 + python3.pkgs.pygobject3 51 + ]; 52 + 53 + postPatch = '' 54 + # Tries to load libpython3.so via g_module_open (). 55 + substituteInPlace meson.build \ 56 + --replace "get_option('prefix'), get_option('libdir')" "'${python3}/lib'" 57 + ''; 58 + 59 + PKG_CONFIG_LIBNEMO_EXTENSION_EXTENSIONDIR = "${placeholder "out"}/${nemo.extensiondir}"; 60 + 61 + meta = with lib; { 62 + homepage = "https://github.com/linuxmint/nemo-extensions/tree/master/nemo-python"; 63 + description = "Python bindings for the Nemo extension library"; 64 + license = licenses.gpl2Plus; 65 + platforms = platforms.linux; 66 + maintainers = teams.cinnamon.members; 67 + }; 68 + }
+27
pkgs/desktops/cinnamon/nemo-extensions/nemo-python/load-extensions-from-env.patch
··· 1 + diff --git a/src/nemo-python.c b/src/nemo-python.c 2 + index 8d2acdb..900811b 100644 3 + --- a/src/nemo-python.c 4 + +++ b/src/nemo-python.c 5 + @@ -255,6 +255,7 @@ nemo_module_initialize(GTypeModule *module) 6 + { 7 + gchar *user_extensions_dir; 8 + const gchar *env_string; 9 + + const gchar *python_extensiondir; 10 + 11 + env_string = g_getenv("NEMO_PYTHON_DEBUG"); 12 + if (env_string != NULL) 13 + @@ -269,8 +270,12 @@ nemo_module_initialize(GTypeModule *module) 14 + 15 + all_types = g_array_new(FALSE, FALSE, sizeof(GType)); 16 + 17 + - // Look in the new global path, $DATADIR/nemo-python/extensions 18 + - nemo_python_load_dir(module, PYTHON_EXTENSION_DIR); 19 + + // Look in NEMO_PYTHON_EXTENSION_DIR 20 + + python_extensiondir = g_getenv("NEMO_PYTHON_EXTENSION_DIR"); 21 + + if (python_extensiondir == NULL) { 22 + + python_extensiondir = PYTHON_EXTENSION_DIR; 23 + + } 24 + + nemo_python_load_dir(module, python_extensiondir); 25 + 26 + // Look in XDG_DATA_DIR, ~/.local/share/nemo-python/extensions 27 + user_extensions_dir = g_build_filename(g_get_user_data_dir(),
+13
pkgs/desktops/cinnamon/nemo-extensions/nemo-python/python-path.patch
··· 1 + diff --git a/src/nemo-python.c b/src/nemo-python.c 2 + index 8d2acdb..ee24143 100644 3 + --- a/src/nemo-python.c 4 + +++ b/src/nemo-python.c 5 + @@ -197,7 +197,7 @@ nemo_python_init_python (void) 6 + } 7 + 8 + debug("Sanitize the python search path"); 9 + - PyRun_SimpleString("import sys; sys.path = [path for path in sys.path if path]"); 10 + + PyRun_SimpleString("import sys; sys.path = [path for path in sys.path if path]; sys.path.append('@env@')"); 11 + if (PyErr_Occurred()) 12 + { 13 + PyErr_Print();
+2 -1
pkgs/desktops/cinnamon/nemo/wrapper.nix
··· 20 20 postBuild = '' 21 21 for f in $(find $out/bin/ $out/libexec/ -type l -not -path "*/.*"); do 22 22 wrapProgram "$f" \ 23 - --set "NEMO_EXTENSION_DIR" "$out/${nemo.extensiondir}" 23 + --set "NEMO_EXTENSION_DIR" "$out/${nemo.extensiondir}" \ 24 + --set "NEMO_PYTHON_EXTENSION_DIR" "$out/share/nemo-python/extensions" 24 25 done 25 26 26 27 # Point to wrapped binary in all service files