Simplify the version mechanism.

No "setuptools-scm" anymore. The version is read by a subprocess
command or using package metadata or the VERSION file.
I still don't know if this is my last attempt to make the
version number reliable...
This commit is contained in:
Sylvain Tricot 2023-12-01 10:24:21 +01:00
parent 44b424e3c6
commit 6c7038cdde
1 changed files with 5 additions and 3 deletions

View File

@ -33,16 +33,18 @@ import subprocess
PKGNAME = 'msspec'
thisfile_path = os.path.abspath(__file__)
thisfile_dir = os.path.dirname(thisfile_path)
try:
cmd = ["git describe|sed 's/-\([0-9]\+\)-.*/.dev\\1/g'"]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, shell=True)
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
shell=True, cwd=thisfile_dir)
__version__ = result.stdout.decode('utf-8').strip()
if __version__ == "":
raise
except Exception as err:
try:
thisfile_path = os.path.abspath(__file__)
thisfile_dir = os.path.dirname(thisfile_path)
versionfile = os.path.join(thisfile_dir, "./VERSION")
with open(versionfile, "r") as fd:
__version__ = fd.readline().strip()