From d2c22f52621a74cd8585bd05470393f407e64dbc Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 4 Dec 2023 05:55:56 -0800 Subject: [PATCH] build: allow installing without git (#492) --- setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ff1b1c598..87bc7c82e 100644 --- a/setup.py +++ b/setup.py @@ -142,11 +142,14 @@ def parse_version(version_file): version = ci_version else: sha = ( - subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here) - .decode("ascii") + subprocess.run( + ["git", "rev-parse", "--short", "HEAD"], capture_output=True, cwd=here + ) + .stdout.decode("ascii") .strip() ) - version += f"+{sha}" + if sha: + version += f"+{sha}" return version