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