From 6c7038cdde3cf3984c9c6fcdbe3da96ae8b7c83e Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Fri, 1 Dec 2023 10:24:21 +0100 Subject: [PATCH] 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... --- src/msspec/version.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/msspec/version.py b/src/msspec/version.py index 74c7351..bd407ab 100644 --- a/src/msspec/version.py +++ b/src/msspec/version.py @@ -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()