git: d07c24fc3fcb - main - misc/thefuck: Fix runtime with Python 3.12

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Mon, 13 Jul 2026 00:20:57 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d07c24fc3fcb4e52dcc09e7c0e6ebad99556d42f

commit d07c24fc3fcb4e52dcc09e7c0e6ebad99556d42f
Author:     Eirik Oeverby <ltning-freebsd@anduin.net>
AuthorDate: 2026-07-13 00:17:38 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-07-13 00:17:38 +0000

    misc/thefuck: Fix runtime with Python 3.12
    
    The old `imp` library was deprecated and is now removed in 3.12; switch
    to importlib.
    
    PR:             296596
    Sponsored by:   UNIS Labs
    MFH:            2026Q3
---
 misc/thefuck/Makefile                     |  2 +-
 misc/thefuck/files/patch-thefuck_conf.py  | 24 ++++++++++++++++++++++++
 misc/thefuck/files/patch-thefuck_types.py | 13 +++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/misc/thefuck/Makefile b/misc/thefuck/Makefile
index b5bf1f2b6aca..58d78e517b84 100644
--- a/misc/thefuck/Makefile
+++ b/misc/thefuck/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	thefuck
 DISTVERSION=	3.32
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	misc python
 MASTER_SITES=	PYPI
 
diff --git a/misc/thefuck/files/patch-thefuck_conf.py b/misc/thefuck/files/patch-thefuck_conf.py
new file mode 100644
index 000000000000..e7509ec6b9dc
--- /dev/null
+++ b/misc/thefuck/files/patch-thefuck_conf.py
@@ -0,0 +1,24 @@
+--- thefuck/conf.py.orig	2021-12-19 20:26:39 UTC
++++ thefuck/conf.py
+@@ -1,10 +1,20 @@
+-from imp import load_source
+ import os
+ import sys
+ from warnings import warn
+ from six import text_type
+ 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):
diff --git a/misc/thefuck/files/patch-thefuck_types.py b/misc/thefuck/files/patch-thefuck_types.py
new file mode 100644
index 000000000000..8bfc750545ed
--- /dev/null
+++ b/misc/thefuck/files/patch-thefuck_types.py
@@ -0,0 +1,13 @@
+--- thefuck/types.py.orig	2021-12-19 20:26:39 UTC
++++ 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