build/tools/get_migen/litex_git_revision: avoid git fatal error message is not instal...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 19 Nov 2019 08:11:11 +0000 (09:11 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 19 Nov 2019 08:11:11 +0000 (09:11 +0100)
litex/build/tools.py

index 7a5bbbd06dad7463e58b26ea748cc629cc30f6e6..30be031c94f953ac1737b80d09507202d6334e8f 100644 (file)
@@ -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)