From f7e34da3e9a385cfdd8dbff84f654539d021a306 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 12 Nov 2024 04:05:16 +0100 Subject: [PATCH] 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 --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 73c4eb8..0226320 100644 --- a/setup.py +++ b/setup.py @@ -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 = []