Merge pull request #173 from gsomlo/gls-git-revision

build: handle exceptional case when litex/migen not deployed as git repo
This commit is contained in:
enjoy-digital 2019-04-24 22:42:36 +02:00 committed by GitHub
commit 5ec99d94ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -95,7 +95,10 @@ def get_migen_git_revision():
import migen import migen
d = os.getcwd() d = os.getcwd()
os.chdir(os.path.dirname(migen.__file__)) os.chdir(os.path.dirname(migen.__file__))
try:
r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])[:-1].decode("utf-8") r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])[:-1].decode("utf-8")
except:
r = "--------"
os.chdir(d) os.chdir(d)
return r return r
@ -103,7 +106,10 @@ def get_litex_git_revision():
import litex import litex
d = os.getcwd() d = os.getcwd()
os.chdir(os.path.dirname(litex.__file__)) os.chdir(os.path.dirname(litex.__file__))
try:
r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])[:-1].decode("utf-8") r = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])[:-1].decode("utf-8")
except:
r = "--------"
os.chdir(d) os.chdir(d)
return r return r