Skip to content

Commit f36388e

Browse files
felbingertropf
andcommitted
inkscape-extensions.inkstitch: fix editor opening
Co-authored-by: tropf <[email protected]>
1 parent 8f44ef0 commit f36388e

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From af541a4f8ddda287f74687327e4ed89b79557777 Mon Sep 17 00:00:00 2001
2+
From: tropf <[email protected]>
3+
Date: Mon, 5 Aug 2024 21:25:33 +0200
4+
Subject: [PATCH 1/3] force frozen=true
5+
6+
Enforce installation in frozen mode, i.e. as a packaged version where
7+
source can not be modified.
8+
---
9+
inkstitch.py | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/inkstitch.py b/inkstitch.py
13+
index 50f33d19..398465ca 100644
14+
--- a/inkstitch.py
15+
+++ b/inkstitch.py
16+
@@ -40,7 +40,7 @@ else:
17+
ini = {}
18+
# --------------------------------------------------------------------------------------------
19+
20+
-running_as_frozen = getattr(sys, 'frozen', None) is not None # check if running from pyinstaller bundle
21+
+running_as_frozen = True
22+
23+
if not running_as_frozen: # override running_as_frozen from DEBUG.toml - for testing
24+
if safe_get(ini, "DEBUG", "force_frozen", default=False):
25+
--
26+
2.36.0
27+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From a86412c57833c24743214c9d3abb76093365769f Mon Sep 17 00:00:00 2001
2+
From: tropf <[email protected]>
3+
Date: Mon, 5 Aug 2024 21:26:13 +0200
4+
Subject: [PATCH 2/3] plugin invocation: use python script as entrypoint
5+
6+
Ink/Stitch is invoked by calling a script with command line parameters.
7+
Depending on the distribution format, this is bundled into a standalone
8+
binary -- at least for vanilla Ink/Stitch. For the nix version, we
9+
follow manual install, which does *not* bundle the file. Hence, the
10+
generation is patched to treat this packaged install as manual install,
11+
and to still refer to the python file.
12+
13+
To keep the patchset small, only an if statement is changed, with the
14+
intent of only using the else path.
15+
---
16+
lib/inx/utils.py | 2 +-
17+
1 file changed, 1 insertion(+), 1 deletion(-)
18+
19+
diff --git a/lib/inx/utils.py b/lib/inx/utils.py
20+
index 9168f2a2..00313639 100755
21+
--- a/lib/inx/utils.py
22+
+++ b/lib/inx/utils.py
23+
@@ -21,7 +21,7 @@ def build_environment():
24+
extensions=['jinja2.ext.i18n']
25+
)
26+
27+
- if "BUILD" in os.environ:
28+
+ if False:
29+
# building a ZIP release, with inkstitch packaged as a binary
30+
# Command tag and icons path
31+
if sys.platform == "win32":
32+
--
33+
2.36.0
34+

pkgs/applications/graphics/inkscape/extensions/inkstitch/default.nix

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let
88
version = "3.1.0";
99
in
10-
python3.pkgs.buildPythonApplication {
10+
python3.pkgs.buildPythonApplication rec {
1111
pname = "inkstitch";
1212
inherit version;
1313
pyproject = false; # Uses a Makefile (yikes)
@@ -54,11 +54,27 @@ python3.pkgs.buildPythonApplication {
5454
runHook preInstall
5555
5656
mkdir -p $out/share/inkscape/extensions
57-
cp -a inx $out/share/inkscape/extensions/inkstitch
57+
cp -a . $out/share/inkscape/extensions/inkstitch
5858
5959
runHook postInstall
6060
'';
6161

62+
patches = [
63+
./0001-force-frozen-true.patch
64+
./0002-plugin-invocation-use-python-script-as-entrypoint.patch
65+
];
66+
67+
postPatch =
68+
let
69+
pyEnv = python3.withPackages (_: dependencies);
70+
in
71+
''
72+
# Add shebang with python dependencies
73+
substituteInPlace lib/inx/utils.py --replace-fail ' interpreter="python"' ""
74+
sed -i -e '1i#!${pyEnv.interpreter}' inkstitch.py
75+
chmod a+x inkstitch.py
76+
'';
77+
6278
nativeCheckInputs = with python3.pkgs; [
6379
pytestCheckHook
6480
];

0 commit comments

Comments
 (0)