From 7dd9a8361269e94ba15c8d77e896b6456679697c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 28 May 2024 22:10:07 +0200 Subject: [PATCH] setup.py: Fix version retrieval on Python 3.13+ Accessing __version__ from locals() no longer works. This was reported to Python in https://github.com/python/cpython/issues/118888 but according to Python developers, it: - is an intended change of behavior described in PEP 667 - was an illegal usage that happens to work in a favored way to begin with --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 91f7d764..4d38c085 100755 --- a/setup.py +++ b/setup.py @@ -25,8 +25,9 @@ def get_install_requires(): def get_version(): cwd = os.path.dirname(__file__) - exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read()) - return locals()['__version__'] + lcls = {} + exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read(), None, lcls) + return lcls['__version__'] def get_long_description():