Fix sdists created by newer setuptools versions.

This caused the PyPI package to be broken since I upgraded
my computer from Debian bullseye
This commit is contained in:
Valentin Lorentz 2021-11-20 14:41:42 +01:00
parent dd3678e481
commit 068488c546
1 changed files with 6 additions and 1 deletions

View File

@ -84,7 +84,12 @@ try:
time.strptime(time.asctime(time.gmtime(date)))[:3])
except:
if os.path.isfile(VERSION_FILE):
from src.version import version
sys.path.insert(0, '') # Missing when installing from an sdist created
# by recent setuptools versions?!
try:
from src.version import version
finally:
sys.path.pop(0)
else:
version = 'installed on ' + time.strftime("%Y-%m-%dT%H-%M-%S", time.gmtime())
try: