litex_setup: Use subprocess so failures are noticed.
authorTim 'mithro' Ansell <me@mith.ro>
Mon, 6 Apr 2020 18:25:11 +0000 (11:25 -0700)
committerTim 'mithro' Ansell <me@mith.ro>
Mon, 6 Apr 2020 18:27:40 +0000 (11:27 -0700)
os.system doesn't report if any of the commands fail. This means that if
something goes wrong it happily reports success making it hard to debug
issues.

litex_setup.py

index e70f31f30d59cd889a98b394276c9741c59b4f0c..be5e819fc81a23b59eb7c52dd315652baa1489fe 100755 (executable)
@@ -2,6 +2,7 @@
 
 import os
 import sys
+import subprocess
 from collections import OrderedDict
 
 
@@ -46,7 +47,9 @@ if "init" in sys.argv[1:]:
         print("[cloning " + name + "]...")
         full_url = url + name
         opts = "--recursive" if need_recursive else ""
-        os.system("git clone " + full_url + " " + opts)
+        subprocess.check_call(
+            "git clone " + full_url + " " + opts,
+            shell=True)
 
 if "install" in sys.argv[1:]:
     for name in repos.keys():
@@ -56,13 +59,19 @@ if "install" in sys.argv[1:]:
         if need_develop:
             os.chdir(os.path.join(current_path, name))
             if "--user" in sys.argv[1:]:
-                os.system("python3 setup.py develop --user")
+                subprocess.check_call(
+                    "python3 setup.py develop --user",
+                    shell=True)
             else:
-                os.system("python3 setup.py develop")
+                subprocess.check_call(
+                    "python3 setup.py develop",
+                    shell=True)
 
 if "update" in sys.argv[1:]:
     for name in repos.keys():
         # update
         print("[updating " + name + "]...")
         os.chdir(os.path.join(current_path, name))
-        os.system("git pull")
+        subprocess.check_call(
+            "git pull",
+            shell=True)