summarylogtreecommitdiffstats
path: root/github-pr-18.patch
diff options
context:
space:
mode:
authorClaudia Pellegrino2024-04-28 23:52:59 +0200
committerClaudia Pellegrino2024-04-28 23:52:59 +0200
commit962b21726193b72aebfa30f69eaa11d031ba646b (patch)
tree68c4486f57a9f17c71fd7e944726e002f37003db /github-pr-18.patch
parente1b8490ffe61716dbff384e14136d07d3b89ad62 (diff)
downloadaur-inkscape-axidraw-bin.tar.gz
Add compatibility patch for Python 3.12
Diffstat (limited to 'github-pr-18.patch')
-rw-r--r--github-pr-18.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/github-pr-18.patch b/github-pr-18.patch
new file mode 100644
index 000000000000..d4bc8ee67223
--- /dev/null
+++ b/github-pr-18.patch
@@ -0,0 +1,35 @@
+From 500e553d0459b0e4904e20520f9e01f8fba1d524 Mon Sep 17 00:00:00 2001
+From: Claudia Pellegrino <claui@users.noreply.github.com>
+Date: Sun, 28 Apr 2024 23:30:51 +0200
+Subject: [PATCH] Use raw string to fix Python 3.12 syntax warning
+
+When running under Python v3.12, the `re.match` invocation in
+`simpletransform.py` causes a syntax warning, because the regexp string
+contains an escape sequence that Python tries to interpret as part of
+the string literal:
+
+```bash
+python -c 'import re; print(re.match("(translate|scale|rotate|skewX|skewY|matrix)\s*\(([^)]*)\)\s*,?", "translate(3.1416)"))'
+<string>:1: SyntaxWarning: invalid escape sequence '\s'
+<re.Match object; span=(0, 17), match='translate(3.1416)'>
+```
+
+The `\s` is really meant to be taken literally and to be passed to the
+regexp engine as is. Use a raw string to achieve that.
+---
+ ink_extensions/simpletransform.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ink_extensions/simpletransform.py b/ink_extensions/simpletransform.py
+index 9cb7651..e615fc1 100755
+--- a/ink_extensions/simpletransform.py
++++ b/ink_extensions/simpletransform.py
+@@ -27,7 +27,7 @@ def parseTransform(transf,mat=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]):
+ if transf=="" or transf==None:
+ return(mat)
+ stransf = transf.strip()
+- result=re.match("(translate|scale|rotate|skewX|skewY|matrix)\s*\(([^)]*)\)\s*,?",stransf)
++ result=re.match(r"(translate|scale|rotate|skewX|skewY|matrix)\s*\(([^)]*)\)\s*,?",stransf)
+ #-- translate --
+ if result.group(1)=="translate":
+ args=result.group(2).replace(',',' ').split()