Browse Source

l/omero-figure: Patched for Python 3.8 support.

slackware-15.0
parent
commit
255320eedf
  1. 39
      l/omero-figure/omero-figure-4.3.1-fix-cgi-escape.patch
  2. 4
      l/omero-figure/omero-figure.SlackBuild

39
l/omero-figure/omero-figure-4.3.1-fix-cgi-escape.patch

@ -0,0 +1,39 @@
commit a004e3c51683240a7fce59d9e8efd022278b54c7
Author: Damien Goutte-Gattat <dgouttegattat@incenp.org>
Date: Tue Jul 7 23:23:41 2020 +0100
Replace cgi.escape by html.escape.
The escape function in the cgi module has been deprecated since
Python 3.2 [1] and has finally been removed in Python 3.8 [2],
resulting in the Figure_To_Pdf.py script failing to run under
Python 3.8.
This patch replaces the call to cgi.escape by html.escape, as
recommended by the Python developers.
[1] https://docs.python.org/3.7/library/cgi.html#cgi.escape
[2] https://docs.python.org/3.8/whatsnew/3.8.html#api-and-feature-removals
diff --git a/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py b/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
index a7a51c4..6955c36 100644
--- a/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
+++ b/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
@@ -20,7 +20,7 @@
import logging
import json
import numpy
-import cgi
+import html
from datetime import datetime
import os
@@ -301,7 +301,7 @@ class ShapeToPdfExport(ShapeExport):
def draw_shape_label(self, shape, bounds):
center = bounds.get_center()
- text = cgi.escape(shape.get('text', ''))
+ text = html.escape(shape.get('text', ''))
if not text or not center:
return
size = shape.get('fontSize', 12) * 2 / 3

4
l/omero-figure/omero-figure.SlackBuild

@ -34,7 +34,7 @@ ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
# Build infos
NAMEPKG=${NAMEPKG:-omero-figure}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -69,6 +69,8 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
# Fix use of removed API in Python 3.8
patch -p 1 < $CWD/omero-figure-4.3.1-fix-cgi-escape.patch
python3 setup.py build
python3 setup.py install --root=$PKG

Loading…
Cancel
Save