From b7303057011197f7007c4660bc3b2a2510db61fe Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Tue, 2 Aug 2022 02:20:55 +0200 Subject: [PATCH] f4pga/setup: optionally use .gitcommit Signed-off-by: Unai Martinez-Corral --- f4pga/setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/f4pga/setup.py b/f4pga/setup.py index b74ab39..263ad34 100644 --- a/f4pga/setup.py +++ b/f4pga/setup.py @@ -55,6 +55,11 @@ def get_requirements(file: Path) -> List[str]: semver = "0.0.0" version = None +with (packagePath.parent / '.gitcommit').open("r") as rptr: + sha = rptr.read().strip() + if sha != '$Format:%h$': + version = f'{semver}-{sha}' + git = which('git') if git is not None: proc = run(['git', 'rev-parse', 'HEAD'], capture_output=True)