--- a/setup.py 2022-12-12 01:15:46.000000000 +0800 +++ b/setup.py 2024-05-01 22:45:01.859557610 +0800 @@ -5,7 +5,8 @@ PROJ_METADATA = '%s.json' % PROJ_NAME -import os, json, imp +import importlib.util +import os, json here = os.path.abspath(os.path.dirname(__file__)) proj_info = json.loads(open(os.path.join(here, PROJ_METADATA), encoding='utf-8').read()) try: @@ -13,12 +14,14 @@ except: README = "" CHANGELOG = open(os.path.join(here, 'CHANGELOG.rst'), encoding='utf-8').read() -VERSION = imp.load_source('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)).__version__ +VSPEC = importlib.util.spec_from_file_location('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)) +VERSION = importlib.util.module_from_spec(VSPEC) +VSPEC.loader.exec_module(VERSION) from setuptools import setup, find_packages setup( name = proj_info['name'], - version = VERSION, + version = VERSION.__version__, author = proj_info['author'], author_email = proj_info['author_email'],