diff options
author | Matt Jolly <kangie@gentoo.org> | 2024-05-12 14:24:15 +1000 |
---|---|---|
committer | Matt Jolly <kangie@gentoo.org> | 2024-05-22 23:17:22 +1000 |
commit | 4cdbd121ddec62fd7674ca96de07602bb96e2538 (patch) | |
tree | 22a94d7fe0fe4937f2261f290c96554fd9d05f41 /app-shells | |
parent | app-shells/thefuck: drop 3.32 (diff) | |
download | gentoo-4cdbd121ddec62fd7674ca96de07602bb96e2538.tar.gz gentoo-4cdbd121ddec62fd7674ca96de07602bb96e2538.tar.bz2 gentoo-4cdbd121ddec62fd7674ca96de07602bb96e2538.zip |
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@gentoo.org>
Diffstat (limited to 'app-shells')
-rw-r--r-- | app-shells/thefuck/files/thefuck-3.32-python-312.patch | 45 | ||||
-rw-r--r-- | app-shells/thefuck/thefuck-3.32-r2.ebuild | 51 |
2 files changed, 96 insertions, 0 deletions
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 <scorphus@gmail.com> +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 +} |