setup.py: Remove deprecated pkg_resources in favor of importlib.util

Remove deprecated `pkg_resources` in favor of `importlib.util`.

Fixes this warning at install-time:
> DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
This commit is contained in:
Christian Clauss 2024-11-12 04:05:16 +01:00 committed by GitHub
parent 271445b2f2
commit f7e34da3e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,14 +1,16 @@
import importlib.util
import platform
import sys
from pathlib import Path
import pkg_resources
from setuptools import find_packages, setup
def read_version(fname="whisper/version.py"):
exec(compile(open(fname, encoding="utf-8").read(), fname, "exec"))
return locals()["__version__"]
spec = importlib.util.spec_from_file_location("version", fname)
version_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version_module)
return version_module.__version__
requirements = []