mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
* gnu/packages/patches/quodlibet-disable-bundled-packages.patch: Add. * gnu/packages/music.scm (quodlibet): [patches]: Add quodlibet-disable-bundled-packages.patch. [snippet]: Remove bundled packages. Change-Id: Ia544b8b1eda2823077892107cc7aaf33ab401057 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
92 lines
2.8 KiB
Diff
92 lines
2.8 KiB
Diff
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)
|