From d905521185fada6fe246e546384eb19e6188e030 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 19 Nov 2019 09:11:11 +0100 Subject: [PATCH] build/tools/get_migen/litex_git_revision: avoid git fatal error message is not installed as a git repository --- litex/build/tools.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litex/build/tools.py b/litex/build/tools.py index 7a5bbbd06..30be031c9 100644 --- a/litex/build/tools.py +++ b/litex/build/tools.py @@ -109,7 +109,8 @@ def get_migen_git_revision(): d = os.getcwd() 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"], + stderr=subprocess.DEVNULL)[:-1].decode("utf-8") except: r = "--------" os.chdir(d) @@ -120,7 +121,8 @@ def get_litex_git_revision(): d = os.getcwd() 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"], + stderr=subprocess.DEVNULL)[:-1].decode("utf-8") except: r = "--------" os.chdir(d)