Skip to content

Commit 7921018

Browse files
marcbonnicisetrofim
authored andcommitted
utils/version: Prevent installation failure on systems without git
On systems that do not have git installed devlib will currently fail to install with a FileNotFound Exception. If git is not present then we will not have a commit hash so just ignore this error.
1 parent 3b8317d commit 7921018

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

devlib/utils/version.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ def get_devlib_version():
3333

3434

3535
def get_commit():
36-
p = Popen(['git', 'rev-parse', 'HEAD'], cwd=os.path.dirname(__file__),
37-
stdout=PIPE, stderr=PIPE)
36+
try:
37+
p = Popen(['git', 'rev-parse', 'HEAD'], cwd=os.path.dirname(__file__),
38+
stdout=PIPE, stderr=PIPE)
39+
except FileNotFoundError:
40+
return None
3841
std, _ = p.communicate()
3942
p.wait()
4043
if p.returncode:

0 commit comments

Comments
 (0)