diff options
author | Arnout Engelen <arnout@bzzt.net> | 2020-09-14 13:42:17 +0200 |
---|---|---|
committer | Arnout Engelen <arnout@bzzt.net> | 2020-11-24 19:35:15 +0100 |
commit | 297d1d6b83c92c4f6942c6479f176d8004a819dd (patch) | |
tree | bb9b6ba18f4094de2970c41f46c35ad77824c802 | |
parent | b5d3cafb691c1b189b2edb93d5b4f247fba0ea9d (diff) |
inkscape: add inkcut extension
3 files changed, 106 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/inkscape/extensions.nix b/pkgs/applications/graphics/inkscape/extensions.nix index 66a758f9fe513..013d3bec3527e 100644 --- a/pkgs/applications/graphics/inkscape/extensions.nix +++ b/pkgs/applications/graphics/inkscape/extensions.nix @@ -1,5 +1,7 @@ { stdenv , fetchFromGitHub +, runCommand +, inkcut }: { @@ -34,4 +36,8 @@ platforms = platforms.all; }; }; + inkcut = (runCommand "inkcut-inkscape-plugin" {} '' + mkdir -p $out/share/inkscape/extensions + cp ${inkcut}/share/inkscape/extensions/* $out/share/inkscape/extensions + ''); } diff --git a/pkgs/applications/misc/inkcut/avoid-name-clash-between-inkcut-and-extension.patch b/pkgs/applications/misc/inkcut/avoid-name-clash-between-inkcut-and-extension.patch new file mode 100644 index 0000000000000..34e4e6f0e7fb8 --- /dev/null +++ b/pkgs/applications/misc/inkcut/avoid-name-clash-between-inkcut-and-extension.patch @@ -0,0 +1,85 @@ +From ddc1f9e63e7a769c71131b56f6a2a011c649635c Mon Sep 17 00:00:00 2001 +From: Arnout Engelen <arnout@bzzt.net> +Date: Tue, 24 Nov 2020 15:34:40 +0100 +Subject: [PATCH] Avoid name clash between inkscape plugin and inkcut itself + +Ohterwise, with an unfortunate PYTONPATH, inkcut would no longer +start since it'd try to invoke the inkcut.py from the extension +instead of the main application +--- + plugins/inkscape/{inkcut.py => inkcut4inkscape.py} | 2 +- + plugins/inkscape/inkcut_cut.inx | 2 +- + plugins/inkscape/inkcut_cut.py | 2 +- + plugins/inkscape/inkcut_open.inx | 2 +- + plugins/inkscape/inkcut_open.py | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + rename plugins/inkscape/{inkcut.py => inkcut4inkscape.py} (98%) + +diff --git a/plugins/inkscape/inkcut.py b/plugins/inkscape/inkcut4inkscape.py +similarity index 98% +rename from plugins/inkscape/inkcut.py +rename to plugins/inkscape/inkcut4inkscape.py +index 5b90475..7dc8d86 100644 +--- a/plugins/inkscape/inkcut.py ++++ b/plugins/inkscape/inkcut4inkscape.py +@@ -2,7 +2,7 @@ + # -*- coding: utf-8 -*- + """ + Inkcut, Plot HPGL directly from Inkscape. +- inkcut.py ++ inkcut4inkscape.py + + Copyright 2018 The Inkcut Team + +diff --git a/plugins/inkscape/inkcut_cut.inx b/plugins/inkscape/inkcut_cut.inx +index 4b44ae5..3db8721 100644 +--- a/plugins/inkscape/inkcut_cut.inx ++++ b/plugins/inkscape/inkcut_cut.inx +@@ -2,7 +2,7 @@ + <_name>Cut selection...</_name> + <id>org.ekips.filter.inkcut.cut</id> + <dependency type="executable" location="extensions">inkcut_cut.py</dependency> +- <dependency type="executable" location="extensions">inkcut.py</dependency> ++ <dependency type="executable" location="extensions">inkcut4inkscape.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + <effect> + <object-type>all</object-type> +diff --git a/plugins/inkscape/inkcut_cut.py b/plugins/inkscape/inkcut_cut.py +index acaf812..777629a 100644 +--- a/plugins/inkscape/inkcut_cut.py ++++ b/plugins/inkscape/inkcut_cut.py +@@ -37,7 +37,7 @@ + else: + inkex.localize() + import subprocess +-from inkcut import contains_text, convert_objects_to_paths ++from inkcut4inkscape import contains_text, convert_objects_to_paths + + + +diff --git a/plugins/inkscape/inkcut_open.inx b/plugins/inkscape/inkcut_open.inx +index 45ee585..2dcd38e 100644 +--- a/plugins/inkscape/inkcut_open.inx ++++ b/plugins/inkscape/inkcut_open.inx +@@ -2,7 +2,7 @@ + <_name>Open current document...</_name> + <id>org.ekips.filter.inkcut.open</id> + <dependency type="executable" location="extensions">inkcut_open.py</dependency> +- <dependency type="executable" location="extensions">inkcut.py</dependency> ++ <dependency type="executable" location="extensions">inkcut4inkscape.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + <effect> + <object-type>all</object-type> +diff --git a/plugins/inkscape/inkcut_open.py b/plugins/inkscape/inkcut_open.py +index b4652eb..e4c2d62 100644 +--- a/plugins/inkscape/inkcut_open.py ++++ b/plugins/inkscape/inkcut_open.py +@@ -38,7 +38,7 @@ + inkex.localize() + import subprocess + +-from inkcut import convert_objects_to_paths ++from inkcut4inkscape import convert_objects_to_paths + + DEBUG = False + try: diff --git a/pkgs/applications/misc/inkcut/default.nix b/pkgs/applications/misc/inkcut/default.nix index cfb10cfbe2f07..481069feac07d 100644 --- a/pkgs/applications/misc/inkcut/default.nix +++ b/pkgs/applications/misc/inkcut/default.nix @@ -17,6 +17,12 @@ buildPythonApplication rec { sha256 = "1zn5i69f3kimcwdd2qkqd3hd1hq76a6i5wxxfb91ih2hj04vdbmx"; }; + patches = [ + # https://github.com/inkcut/inkcut/pull/292 but downloaded + # because of https://github.com/NixOS/nixpkgs/issues/32084 + ./avoid-name-clash-between-inkcut-and-extension.patch + ]; + nativeBuildInputs = [ wrapQtAppsHook ]; propagatedBuildInputs = [ @@ -49,6 +55,15 @@ buildPythonApplication rec { dontWrapQtApps = true; makeWrapperArgs = [ "\${qtWrapperArgs[@]}" ]; + postInstall = '' + mkdir -p $out/share/inkscape/extensions + + cp plugins/inkscape/* $out/share/inkscape/extensions + + sed -i "s|cmd = \['inkcut'\]|cmd = \['$out/bin/inkcut'\]|" $out/share/inkscape/extensions/inkcut_cut.py + sed -i "s|cmd = \['inkcut'\]|cmd = \['$out/bin/inkcut'\]|" $out/share/inkscape/extensions/inkcut_open.py + ''; + meta = with lib; { homepage = "https://www.codelv.com/projects/inkcut/"; description = "Control 2D plotters, cutters, engravers, and CNC machines"; |