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
This commit is contained in:
Miro Hrončok 2024-05-28 22:10:07 +02:00 committed by Tomas Kopecek
parent 2bf10c7010
commit 7dd9a83612

View file

@ -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():