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>
This commit is contained in:
Matt Jolly
2024-05-12 14:24:15 +10:00
parent e283e16f59
commit 4cdbd121dd
2 changed files with 96 additions and 0 deletions

View File

@@ -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

View File

@@ -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
}