public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/tempita/, dev-python/tempita/files/
@ 2020-09-17 19:13 Louis Sautier
  0 siblings, 0 replies; only message in thread
From: Louis Sautier @ 2020-09-17 19:13 UTC (permalink / raw
  To: gentoo-commits

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}"
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-17 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17 19:13 [gentoo-commits] repo/gentoo:master commit in: dev-python/tempita/, dev-python/tempita/files/ Louis Sautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox