* [PR PATCH] screenplain: add patches for python3.8
@ 2020-05-14 13:24 abenson
2020-05-14 13:46 ` [PR PATCH] [Merged]: " abenson
0 siblings, 1 reply; 2+ messages in thread
From: abenson @ 2020-05-14 13:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
There is a new pull request by abenson against master on the void-packages repository
https://github.com/abenson/void-packages sp_fix_py38
https://github.com/void-linux/void-packages/pull/21959
screenplain: add patches for python3.8
A patch file from https://github.com/void-linux/void-packages/pull/21959.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sp_fix_py38-21959.patch --]
[-- Type: text/x-diff, Size: 6840 bytes --]
From e9e20a4d7fa4c1259732e7cafc7d8862aa39da0e Mon Sep 17 00:00:00 2001
From: Andrew Benson <abenson+void@gmail.com>
Date: Thu, 14 May 2020 08:19:49 -0500
Subject: [PATCH] screenplain: add patches for python3.8
---
.../patches/python3-cgi-escape.patch | 78 +++++++++++++++++++
.../patches/python3-stdout-buffer.patch | 35 +++++++++
srcpkgs/screenplain/template | 4 +-
3 files changed, 115 insertions(+), 2 deletions(-)
create mode 100644 srcpkgs/screenplain/patches/python3-cgi-escape.patch
create mode 100644 srcpkgs/screenplain/patches/python3-stdout-buffer.patch
diff --git a/srcpkgs/screenplain/patches/python3-cgi-escape.patch b/srcpkgs/screenplain/patches/python3-cgi-escape.patch
new file mode 100644
index 00000000000..4d96a757da0
--- /dev/null
+++ b/srcpkgs/screenplain/patches/python3-cgi-escape.patch
@@ -0,0 +1,78 @@
+https://github.com/vilcans/screenplain/commit/0e4eb9bff3763d3372f23b27f9c2390705e2d962.patch
+
+From 0e4eb9bff3763d3372f23b27f9c2390705e2d962 Mon Sep 17 00:00:00 2001
+From: Jakub Stasiak <jakub@stasiak.at>
+Date: Fri, 7 Feb 2020 12:59:24 +0100
+Subject: [PATCH] Fix "AttributeError: module 'cgi' has no attribute 'escape'"
+ on Python 3.8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Full error:
+
+ % screenplain Big-Fish.fountain Big-Fish.html
+ Traceback (most recent call last):
+ File "/Users/user/.ve38/bin/screenplain", line 6, in <module>
+ main(sys.argv[1:])
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/main.py", line 125, in main
+ convert(
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 183, in convert
+ convert_full(
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 210, in convert_full
+ convert_bare(screenplay, out)
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 225, in convert_bare
+ formatter.convert(screenplay)
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 99, in convert
+ format_function(para)
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 153, in format_action
+ self.out.write(to_html(line))
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/export/html.py", line 60, in to_html
+ html = text.to_html()
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/richstring.py", line 62, in to_html
+ html = ''.join(seg.to_html() for seg in self.segments)
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/richstring.py", line 62, in <genexpr>
+ html = ''.join(seg.to_html() for seg in self.segments)
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/richstring.py", line 136, in to_html
+ _escape(self.text),
+ File "/Users/user/.ve38/lib/python3.8/site-packages/screenplain/richstring.py", line 17, in _escape
+ encoded = cgi.escape(s).encode('ascii', 'xmlcharrefreplace')
+ AttributeError: module 'cgi' has no attribute 'escape'
+
+cgi.escape() is gone in Python 3.8, html.escape() should be used
+instead. Since html.escape() defaults to quote=True, we need to
+explicitly disable escaping quotation marks to keep doing the same
+thing. A question arises though – should quotation marks be actually
+kept verbatim here or was it unintentional?
+---
+ screenplain/richstring.py | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/screenplain/richstring.py b/screenplain/richstring.py
+index ad667d1..1859e12 100644
+--- a/screenplain/richstring.py
++++ b/screenplain/richstring.py
+@@ -3,9 +3,13 @@
+ # http://www.opensource.org/licenses/mit-license.php
+
+ import re
+-import cgi
+ import six
+
++try:
++ from html import escape as html_escape
++except ImportError:
++ from cgi import escape as html_escape
++
+ _magic_re = re.compile(u'[\ue700-\ue705]')
+
+
+@@ -14,7 +18,7 @@ def _escape(s):
+ and non-ascii characters with ampersand escapes.
+
+ """
+- encoded = cgi.escape(s).encode('ascii', 'xmlcharrefreplace')
++ encoded = html_escape(s, quote=False).encode('ascii', 'xmlcharrefreplace')
+ # In Py3, encoded is bytes type, so convert it to a string
+ return encoded.decode('ascii')
+
diff --git a/srcpkgs/screenplain/patches/python3-stdout-buffer.patch b/srcpkgs/screenplain/patches/python3-stdout-buffer.patch
new file mode 100644
index 00000000000..f9f22ccd158
--- /dev/null
+++ b/srcpkgs/screenplain/patches/python3-stdout-buffer.patch
@@ -0,0 +1,35 @@
+https://github.com/vilcans/screenplain/commit/e946ac7cdb4e61458502da629d79d78cac22d060.patch
+
+From e946ac7cdb4e61458502da629d79d78cac22d060 Mon Sep 17 00:00:00 2001
+From: Jakub Stasiak <jakub@stasiak.at>
+Date: Sat, 8 Feb 2020 13:52:06 +0100
+Subject: [PATCH] Fix "TypeError: write() argument must be str, not bytes" on
+ Python 3
+
+This used to happen when writing to stdout. On Python 3 stdout is an
+instance of TextIOWrapper which is a text-based interface. It wraps a
+bytes-based writer though which is accessible through the buffer
+attribute, so let's use that to either write to it directly or to get an
+encoding writer.
+
+Fixes https://github.com/vilcans/screenplain/issues/53.
+---
+ screenplain/main.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/screenplain/main.py b/screenplain/main.py
+index 770427c..313498f 100644
+--- a/screenplain/main.py
++++ b/screenplain/main.py
+@@ -109,9 +109,9 @@ def main(args):
+ output = open(output_file, 'wb')
+ else:
+ if output_encoding:
+- output = codecs.getwriter(output_encoding)(sys.stdout)
++ output = codecs.getwriter(output_encoding)(sys.stdout.buffer)
+ else:
+- output = sys.stdout
++ output = sys.stdout.buffer
+
+ try:
+ if format == 'text':
diff --git a/srcpkgs/screenplain/template b/srcpkgs/screenplain/template
index 8eb759ae6a6..341668cf1fa 100644
--- a/srcpkgs/screenplain/template
+++ b/srcpkgs/screenplain/template
@@ -1,10 +1,9 @@
# Template file for 'screenplain'
pkgname=screenplain
version=0.8.0
-revision=2
+revision=3
archs=noarch
build_style=python3-module
-pycompile_module="screenplain"
hostmakedepends="python3-setuptools"
depends="python3-reportlab python3-six"
short_desc="Convert Fountain screenplays to HMTL, FDX, and PDF"
@@ -13,6 +12,7 @@ license="MIT"
homepage="http://www.screenplain.com/"
distfiles="https://github.com/vilcans/screenplain/archive/${version}.tar.gz"
checksum=aef5e50bf4ea072c3d3a9384b66fe34a40e8d2d55ed226624aaabc226cec0d9a
+patch_args="-Np1"
post_install() {
vlicense LICENSE.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PR PATCH] [Merged]: screenplain: add patches for python3.8
2020-05-14 13:24 [PR PATCH] screenplain: add patches for python3.8 abenson
@ 2020-05-14 13:46 ` abenson
0 siblings, 0 replies; 2+ messages in thread
From: abenson @ 2020-05-14 13:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
There's a merged pull request on the void-packages repository
screenplain: add patches for python3.8
https://github.com/void-linux/void-packages/pull/21959
Description:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-14 13:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 13:24 [PR PATCH] screenplain: add patches for python3.8 abenson
2020-05-14 13:46 ` [PR PATCH] [Merged]: " abenson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).