python3Packages.inkex: Apply patch to fix binary DXF parsing on big-endian (#511396)

This commit is contained in:
Sandro
2026-06-09 23:42:29 +00:00
committed by GitHub
2 changed files with 34 additions and 0 deletions
@@ -0,0 +1,30 @@
From 7e103db5e99a82751361d4e9fa926200315bd9d3 Mon Sep 17 00:00:00 2001
From: Amaan Qureshi <git@amaanq.com>
Date: Fri, 20 Mar 2026 21:56:15 -0400
Subject: [PATCH] dxf: fix binary DXF double parsing on big-endian
struct.unpack("d") uses native byte order, but the DXF binary format
is always little-endian. All other fields in the parser already use '<'
for little-endian. Without this fix, double-precision coordinates are
byte-swapped on big-endian hosts, producing garbage values that cascade
into empty SVG transforms and ValueErrors.
---
dxf_input.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/share/extensions/dxf_input.py b/share/extensions/dxf_input.py
index 3f5ce96d..17f62034 100644
--- a/share/extensions/dxf_input.py
+++ b/share/extensions/dxf_input.py
@@ -1336,7 +1336,7 @@ class DxfInput(inkex.InputExtension):
or 460 <= key <= 469
or 1010 <= key <= 1059
):
- value = struct.unpack("d", stream.read(8))[0]
+ value = struct.unpack("<d", stream.read(8))[0]
elif (
60 <= key <= 79
or 170 <= key <= 179
--
GitLab
@@ -35,6 +35,10 @@ buildPythonPackage {
stripLen = 1;
extraPrefix = "share/extensions/";
})
# Fix binary DXF parsing on big-endian
# https://gitlab.com/inkscape/extensions/-/merge_requests/721
./1001-dxf-fix-binary-dxf-double-parsing-on-big-endian.patch
];
build-system = [ poetry-core ];