commit:     8caaa24064a410aa3c5960cd1260ede377329d57
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 28 16:19:20 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 28 16:25:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8caaa240

dev-python/bottle: Enable py3.12

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/bottle/bottle-0.12.25-r1.ebuild         | 50 ++++++++++++++++++++++
 dev-python/bottle/files/bottle-0.12.25-py312.patch | 35 +++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/dev-python/bottle/bottle-0.12.25-r1.ebuild 
b/dev-python/bottle/bottle-0.12.25-r1.ebuild
new file mode 100644
index 000000000000..8cbff0a525a7
--- /dev/null
+++ b/dev-python/bottle/bottle-0.12.25-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} pypy3 )
+
+inherit distutils-r1 optfeature pypi
+
+DESCRIPTION="A fast and simple micro-framework for small web-applications"
+HOMEPAGE="
+       https://bottlepy.org/
+       https://github.com/bottlepy/bottle/
+       https://pypi.org/project/bottle/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+
+BDEPEND="
+       test? (
+               dev-python/mako[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       # https://github.com/bottlepy/bottle/issues/1422
+       "${FILESDIR}/${P}-py312.patch"
+)
+
+distutils_enable_tests unittest
+
+python_prepare_all() {
+       sed -e '/scripts/d' -i setup.py || die
+
+       # Remove test file requiring connection to network
+       rm test/test_server.py || die
+       distutils-r1_python_prepare_all
+}
+
+pkg_postinst() {
+       optfeature "Templating support" dev-python/mako
+       elog "Due to problems with bottle.py being in /usr/bin (see bug 
#474874)"
+       elog "we do as most other distros and do not install the script 
anymore."
+       elog "If you do want/have to call it directly rather than through your 
app,"
+       elog "please use the following instead:"
+       elog '  `python -m bottle`'
+}

diff --git a/dev-python/bottle/files/bottle-0.12.25-py312.patch 
b/dev-python/bottle/files/bottle-0.12.25-py312.patch
new file mode 100644
index 000000000000..717463841af5
--- /dev/null
+++ b/dev-python/bottle/files/bottle-0.12.25-py312.patch
@@ -0,0 +1,35 @@
+From ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd Mon Sep 17 00:00:00 2001
+From: Marcel Hellkamp <m...@gsites.de>
+Date: Sun, 12 Jun 2022 15:15:35 +0200
+Subject: [PATCH] Fix #1378: Module loader should move from find_mdoule to
+ find_spec.
+
+---
+ bottle.py | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/bottle.py b/bottle.py
+index 8e7e3d7..63e55cf 100755
+--- a/bottle.py
++++ b/bottle.py
+@@ -2068,10 +2068,15 @@ class _ImportRedirect(object):
+         })
+         sys.meta_path.append(self)
+ 
++    def find_spec(self, fullname, path, target=None):
++        if '.' not in fullname: return
++        if fullname.rsplit('.', 1)[0] != self.name: return
++        from importlib.util import spec_from_loader
++        return spec_from_loader(fullname, self)
++
+     def find_module(self, fullname, path=None):
+         if '.' not in fullname: return
+-        packname = fullname.rsplit('.', 1)[0]
+-        if packname != self.name: return
++        if fullname.rsplit('.', 1)[0] != self.name: return
+         return self
+ 
+     def load_module(self, fullname):
+-- 
+2.40.1
+

Reply via email to