1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
commit 5fd86d2158f7113879f0f150604fbd5435231531
Author: Remco van 't Veer <remco@remworks.net>
Date: Sat Jun 7 12:52:00 2025 +0200
Disable loading bundled packages
diff --git a/quodlibet/__init__.py b/quodlibet/__init__.py
index d740aaeaf..d99bb2271 100644
--- a/quodlibet/__init__.py
+++ b/quodlibet/__init__.py
@@ -16,10 +16,6 @@ if sys.platform == "win32":
windll.kernel32.SetDllDirectoryW(os.path.dirname(sys.executable))
-from ._import import install_redirect_import_hook
-
-install_redirect_import_hook()
-
from .util.i18n import _, C_, N_, ngettext, npgettext
from .util.dprint import print_d, print_e, print_w
from ._init import init_cli, init
diff --git a/quodlibet/_import.py b/quodlibet/_import.py
deleted file mode 100644
index eb70c8ea9..000000000
--- a/quodlibet/_import.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2017 Christoph Reiter
-# 2020 Nick Boultbee
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-import sys
-import importlib
-import importlib.util
-
-
-class RedirectImportHook:
- """Import hook which loads packages as sub packages.
-
- e.g. "import raven" will import "quodlibet.packages.raven" even
- if raven uses absolute imports internally.
- """
-
- def __init__(self, name, packages):
- """
- Args:
- name (str): The package path to load the packages from
- packages (List[str]): A list of packages provided
- """
-
- for package in packages:
- if package in sys.modules:
- raise Exception(f"{package!r} already loaded, can't redirect")
-
- self._name = name
- self._packages = packages
-
- def find_spec(self, fullname, path, target=None):
- loader = self.find_module(fullname, path)
- if loader is not None:
- return importlib.util.spec_from_loader(fullname, loader)
- return None
-
- def find_module(self, fullname, path=None):
- package = fullname.split(".")[0]
- if package in self._packages:
- return self
- return None
-
- def load_module(self, name):
- mod = None
- if name in sys.modules:
- mod = sys.modules[name]
- loadname = self._name + "." + name
- if loadname in sys.modules:
- mod = sys.modules[loadname]
- if mod is None:
- mod = importlib.import_module(loadname)
- sys.modules[name] = mod
- sys.modules[loadname] = mod
- return mod
-
-
-def install_redirect_import_hook():
- """Install the import hook, does not import anything"""
-
- import_hook = RedirectImportHook("quodlibet.packages", ["senf", "raven"])
- sys.meta_path.insert(0, import_hook)
|