summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch
diff options
context:
space:
mode:
authorFelix Gruber <felgru@posteo.net>2024-07-07 18:04:24 +0000
committerLudovic Courtès <ludo@gnu.org>2024-07-18 17:31:19 +0200
commit0514502408a480d6b15b878cf7f2c1fcfc927e2c (patch)
tree2aaf7bc3061b07ce0ddc810deb9de07746e114ce /gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch
parente0cb8cb6e1cde40cfb7cf40fcf5c0a775e5301b4 (diff)
gnu: Add python-xmp-toolkit.
* gnu/packages/python-xyz.scm (python-xmp-toolkit): New variable. * gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Change-Id: Ibce05155961eb5ba199754646e08acff2410f95d Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch')
-rw-r--r--gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch b/gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch
new file mode 100644
index 0000000000..17bdae188f
--- /dev/null
+++ b/gnu/packages/patches/python-xmp-toolkit-add-missing-error-codes.patch
@@ -0,0 +1,51 @@
+From fd9e887a1853d9b4bc3fce20d414d648fb5abbfc Mon Sep 17 00:00:00 2001
+From: Asher Glick <asher.glick@gmail.com>
+Date: Mon, 1 Mar 2021 14:35:46 -0600
+Subject: [PATCH] Add missing error codes and graceful handling of possible
+ future missing codes.
+
+---
+ libxmp/exempi.py | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/libxmp/exempi.py b/libxmp/exempi.py
+index 683e240..f58003c 100644
+--- a/libxmp/exempi.py
++++ b/libxmp/exempi.py
+@@ -85,6 +85,7 @@ ERROR_MESSAGE = { 0: "unknown error",
+ -13: "std exception",
+ -14: "unknown exception",
+ -15: "no memory",
++ -16: "progress abort",
+ -101: "bad schema",
+ -102: "bad XPath",
+ -103: "bad options",
+@@ -95,6 +96,14 @@ ERROR_MESSAGE = { 0: "unknown error",
+ -108: "bad file format",
+ -109: "no file handler",
+ -110: "too large for JPEG",
++ -111: "no file",
++ -112: "file permission error",
++ -113: "disk space",
++ -114: "read error",
++ -115: "write error",
++ -116: "bad block format",
++ -117: "file path not a file",
++ -118: "rejected file extension",
+ -201: "bad XML",
+ -202: "bad RDF",
+ -203: "bad XMP",
+@@ -1697,6 +1706,9 @@ def check_error(success):
+ # so we supplement it by explicitly checking the error code.
+ ecode = EXEMPI.xmp_get_error()
+ if not success or ecode != 0:
+- error_msg = ERROR_MESSAGE[ecode]
++ if ecode in ERROR_MESSAGE:
++ error_msg = ERROR_MESSAGE[ecode]
++ else:
++ error_msg = "Unexpected error code " + str(ecode)
+ msg = 'Exempi function failure ("{0}").'.format(error_msg)
+ raise XMPError(msg)
+--
+2.30.2
+