mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-16 06:07:00 +02:00
thefuck: import upstream patch for python 3.12
This commit is contained in:
parent
95834d2c82
commit
80971e67b1
2 changed files with 54 additions and 1 deletions
|
@ -0,0 +1,53 @@
|
|||
From 0420442e778dd7bc53bdbdb50278eea2c207dc74 Mon Sep 17 00:00:00 2001
|
||||
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.
|
||||
---
|
||||
thefuck/conf.py | 12 +++++++++++-
|
||||
thefuck/types.py | 3 +--
|
||||
3 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/thefuck/conf.py b/thefuck/conf.py
|
||||
index 27876ef47..611ec84b7 100644
|
||||
--- 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):
|
||||
diff --git a/thefuck/types.py b/thefuck/types.py
|
||||
index 96e6ace67..b3b64c35d 100644
|
||||
--- 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
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'thefuck'
|
||||
pkgname=thefuck
|
||||
version=3.32
|
||||
revision=3
|
||||
revision=4
|
||||
build_style=python3-module
|
||||
hostmakedepends="python3-setuptools"
|
||||
depends="python3-colorama python3-decorator python3-psutil python3-pyte
|
||||
|
|
Loading…
Add table
Reference in a new issue