commit:     4cdbd121ddec62fd7674ca96de07602bb96e2538
Author:     Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Sun May 12 04:24:15 2024 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Wed May 22 13:17:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cdbd121

app-shells/thefuck: add 3.32-r2

This backports the upstream py312 patch.

There are four failing tests that do not fail with py311.

Minimum python is now 3.10

Bug: https://bugs.gentoo.org/929026
Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 .../thefuck/files/thefuck-3.32-python-312.patch    | 45 +++++++++++++++++++
 app-shells/thefuck/thefuck-3.32-r2.ebuild          | 51 ++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/app-shells/thefuck/files/thefuck-3.32-python-312.patch 
b/app-shells/thefuck/files/thefuck-3.32-python-312.patch
new file mode 100644
index 000000000000..96554b046dcd
--- /dev/null
+++ b/app-shells/thefuck/files/thefuck-3.32-python-312.patch
@@ -0,0 +1,45 @@
+https://github.com/nvbn/thefuck/commit/0420442e778dd7bc53bdbdb50278eea2c207dc74
+From: Pablo Santiago Blum de Aguiar <[email protected]>
+Date: Mon, 10 Jul 2023 14:43:45 +0200
+Subject: [PATCH] #1248: Use imp only when importlib.util not available
+
+The imp module is deprecated and will be removed in Python 12.
+
+--- a/thefuck/conf.py
++++ b/thefuck/conf.py
+@@ -1,4 +1,3 @@
+-from imp import load_source
+ import os
+ import sys
+ from warnings import warn
+@@ -6,6 +5,17 @@
+ from . import const
+ from .system import Path
+ 
++try:
++    import importlib.util
++
++    def load_source(name, pathname, _file=None):
++        module_spec = importlib.util.spec_from_file_location(name, pathname)
++        module = importlib.util.module_from_spec(module_spec)
++        module_spec.loader.exec_module(module)
++        return module
++except ImportError:
++    from imp import load_source
++
+ 
+ class Settings(dict):
+     def __getattr__(self, item):
+--- a/thefuck/types.py
++++ b/thefuck/types.py
+@@ -1,9 +1,8 @@
+-from imp import load_source
+ import os
+ import sys
+ from . import logs
+ from .shells import shell
+-from .conf import settings
++from .conf import settings, load_source
+ from .const import DEFAULT_PRIORITY, ALL_ENABLED
+ from .exceptions import EmptyCommand
+ from .utils import get_alias, format_raw_script

diff --git a/app-shells/thefuck/thefuck-3.32-r2.ebuild 
b/app-shells/thefuck/thefuck-3.32-r2.ebuild
new file mode 100644
index 000000000000..e0aaf60c480d
--- /dev/null
+++ b/app-shells/thefuck/thefuck-3.32-r2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="Magnificent app which corrects your previous console command"
+HOMEPAGE="https://github.com/nvbn/thefuck";
+SRC_URI="https://github.com/nvbn/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+
+RDEPEND="
+       dev-python/psutil[${PYTHON_USEDEP}]
+       dev-python/six[${PYTHON_USEDEP}]
+       dev-python/decorator[${PYTHON_USEDEP}]
+       dev-python/colorama[${PYTHON_USEDEP}]
+       dev-python/pyte[${PYTHON_USEDEP}]"
+DEPEND="
+       test? (
+               dev-python/mock[${PYTHON_USEDEP}]
+               dev-python/pytest-mock[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-python-312.patch
+)
+
+distutils_enable_tests pytest
+
+EPYTEST_DESELECT=(
+       # failing tests because of trying to access portage's home dir
+       tests/test_conf.py
+       tests/entrypoints/test_not_configured.py
+       tests/test_utils.py::test_get_all_executables_exclude_paths
+       tests/test_utils.py::TestCache
+       # These tests fail with py312; #929026
+       
tests/test_utils.py::TestGetValidHistoryWithoutCurrent::test_get_valid_history_without_current
+)
+
+python_prepare_all() {
+       sed -i -e "/import pip/s/^/#/" -e "/pip.__version__/,+3 s/^/#/" 
setup.py || die
+       distutils-r1_python_prepare_all
+}

Reply via email to