No longer rely on pkg_resources

Signed-off-by: Katharina Dröge <kate@commandmc.de>
This commit is contained in:
Katharina Dröge
2025-09-24 21:52:02 +02:00
parent bc8b96d956
commit adab25986f
6 changed files with 13 additions and 46 deletions

View File

@@ -3,14 +3,11 @@
import os
import sys
import pkg_resources
import musicbrainzngs
import site
import whipper
from distutils.sysconfig import get_python_lib
from whipper.command import cd, offset, drive, image, accurip, mblookup
from whipper.command.basecommand import BaseCommand
from whipper.common import common, directory, config
from whipper.common import common, config
from whipper.extern.task import task
from whipper.program.utils import eject_device
@@ -35,22 +32,6 @@ def main():
"to make it work in whipper.", server['netloc'])
musicbrainzngs.set_hostname(server['netloc'])
# Find whipper's plugins paths (local paths have higher priority)
plugins_p = [directory.data_path('plugins')] # local path (in $HOME)
if hasattr(sys, 'real_prefix'): # no getsitepackages() in virtualenv
plugins_p.append(
get_python_lib(plat_specific=False, standard_lib=False,
prefix='/usr/local') + '/whipper/plugins')
plugins_p.append(get_python_lib(plat_specific=False,
standard_lib=False) + '/whipper/plugins')
else:
plugins_p += [x + '/whipper/plugins' for x in site.getsitepackages()]
# register plugins with pkg_resources
distributions, _ = pkg_resources.working_set.find_plugins(
pkg_resources.Environment(plugins_p)
)
list(map(pkg_resources.working_set.add, distributions))
try:
cmd = Whipper(sys.argv[1:], os.path.basename(sys.argv[0]), None)
ret = cmd.do()