From: "Louis Sautier" <sbraz@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/tempita/, dev-python/tempita/files/
Date: Thu, 17 Sep 2020 19:13:14 +0000 (UTC) [thread overview]
Message-ID: <1600369524.09eaf73828ac4bc0794332448c2dd6144fb429e6.sbraz@gentoo> (raw)
commit: 09eaf73828ac4bc0794332448c2dd6144fb429e6
Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 18:52:41 2020 +0000
Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 19:05:24 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09eaf738
dev-python/tempita: add python 3.9 support by removing cgi.escape
Package-Manager: Portage-3.0.7, Repoman-3.0.1
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>
.../tempita/files/tempita-0.5.3-cgi-escape.patch | 31 +++++++++++++
dev-python/tempita/tempita-0.5.3-r3.ebuild | 52 ++++++++++++++++++++++
2 files changed, 83 insertions(+)
diff --git a/dev-python/tempita/files/tempita-0.5.3-cgi-escape.patch b/dev-python/tempita/files/tempita-0.5.3-cgi-escape.patch
new file mode 100644
index 00000000000..d411d28ced4
--- /dev/null
+++ b/dev-python/tempita/files/tempita-0.5.3-cgi-escape.patch
@@ -0,0 +1,31 @@
+diff --git a/tempita/__init__.py b/tempita/__init__.py
+index 137ba2d..acc2fd9 100755
+--- a/tempita/__init__.py
++++ b/tempita/__init__.py
+@@ -31,12 +31,12 @@ can use ``__name='tmpl.html'`` to set the name of the template.
+ If there are syntax errors ``TemplateError`` will be raised.
+ """
+
+-import cgi
+ import os
+ import re
+ import sys
+ import tokenize
+ from cStringIO import StringIO
++from html import escape
+ from urllib import quote as url_quote
+ from tempita._looper import looper
+ from tempita.compat3 import bytes, basestring_, next, is_unicode, coerce_text
+@@ -445,10 +445,10 @@ def html_quote(value, force=True):
+ if not isinstance(value, basestring_):
+ value = coerce_text(value)
+ if sys.version >= "3" and isinstance(value, bytes):
+- value = cgi.escape(value.decode('latin1'), 1)
++ value = escape(value.decode('latin1'), 1)
+ value = value.encode('latin1')
+ else:
+- value = cgi.escape(value, 1)
++ value = escape(value, 1)
+ if sys.version < "3":
+ if is_unicode(value):
+ value = value.encode('ascii', 'xmlcharrefreplace')
diff --git a/dev-python/tempita/tempita-0.5.3-r3.ebuild b/dev-python/tempita/tempita-0.5.3-r3.ebuild
new file mode 100644
index 00000000000..d455c913ca0
--- /dev/null
+++ b/dev-python/tempita/tempita-0.5.3-r3.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( pypy3 python3_{6,7,8,9} )
+# The package uses pkg_resources
+DISTUTILS_USE_SETUPTOOLS=manual
+
+inherit distutils-r1
+
+MY_COMMIT="97392d008cc8"
+
+DESCRIPTION="A very small text templating language"
+HOMEPAGE="https://pypi.org/project/Tempita/"
+# Tests are not published on PyPI
+SRC_URI="https://bitbucket.org/ianb/${PN}/get/${MY_COMMIT}.tar.gz -> ${P}-bitbucket.tar.gz"
+S="${WORKDIR}/ianb-${PN}-${MY_COMMIT}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+BDEPEND="
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? ( dev-python/pytest[${PYTHON_USEDEP}] )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-pypy-tests.patch"
+ # cgi.escape has been removed in Python 3.9
+ "${FILESDIR}/${P}-cgi-escape.patch"
+)
+
+distutils_enable_sphinx docs
+
+python_prepare_all() {
+ # Remove reference to a non-existent CSS file
+ # in order to make sphinx use its default theme.
+ sed -i '/^html_style =/d' docs/conf.py || die
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ # We need to append to sys.path, otherwise pytest imports
+ # the module from ${S} (before it was 2to3'd)
+ pytest --import-mode=append -vv tests/test_template.txt docs/index.txt \
+ || die "Tests failed with ${EPYTHON}"
+}
reply other threads:[~2020-09-17 19:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1600369524.09eaf73828ac4bc0794332448c2dd6144fb429e6.sbraz@gentoo \
--to=sbraz@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox