add litex_setup script to clone and install Migen, LiteX and LiteX's cores
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 20 Jul 2018 08:11:41 +0000 (10:11 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 20 Jul 2018 08:11:41 +0000 (10:11 +0200)
README
litex_setup.py [new file with mode: 0755]

diff --git a/README b/README
index b01db248f1734740d43779ab563ba533b719f94a..562de2163a836bf95663616bb3dbf8a62d218255 100644 (file)
--- a/README
+++ b/README
@@ -102,11 +102,13 @@ FPGA lessons/tutorials can be found at: https://github.com/enjoy-digital/fpga_10
 
 [> Quick start guide (for advanced users)
 -----------------------------------------
-0. If cloned from Git without the --recursive option, get the submodules:
-  git submodule update --init
+0. Install Python 3.5+ and FPGA vendor's development tools.
 
-1. Install Python 3.5, Migen and FPGA vendor's development tools.
-   Get Migen from: https://github.com/m-labs/migen
+1. Get litex_setup.py script and execute:
+   ./litex_setup.py init install
+   This will clone and install Migen, LiteX and LiteX's cores.
+   To update all repositories execute:
+   ./litex_setup.py update
 
 2. Compile and install binutils. Take the latest version from GNU.
   mkdir build && cd build
diff --git a/litex_setup.py b/litex_setup.py
new file mode 100755 (executable)
index 0000000..0275a0b
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from collections import OrderedDict
+
+
+current_path = os.path.dirname(os.path.realpath(__file__))
+
+# name,  (url, recursive clone, develop)
+repos = [
+    ("migen",      ("http://github.com/m-labs/",        True,  True)),
+    ("litex",      ("http://github.com/enjoy-digital/", True,  True)),
+    ("liteeth",    ("http://github.com/enjoy-digital/", False, True)),
+    ("liteusb",    ("http://github.com/enjoy-digital/", False, True)),
+    ("litedram",   ("http://github.com/enjoy-digital/", False, True)),
+    ("litepcie",   ("http://github.com/enjoy-digital/", False, True)),
+    ("litesdcard", ("http://github.com/enjoy-digital/", False, True)),
+    ("liteiclink", ("http://github.com/enjoy-digital/", False, True)),
+    ("litevideo",  ("http://github.com/enjoy-digital/", False, True)),
+    ("litescope",  ("http://github.com/enjoy-digital/", False, True)),
+]
+repos = OrderedDict(repos)
+
+if len(sys.argv) < 2:
+    print("Available commands:")
+    print("- init")
+    print("- install")
+    print("- update")
+    exit()
+
+if "init" in sys.argv[1:]:
+    for name in repos.keys():
+        url, need_recursive, need_develop = repos[name]
+        # clone repo (recursive if needed)
+        print("[cloning " + name + "]...")
+        full_url = url + name
+        opts = "--recursive" if need_recursive else ""
+        os.system("git clone " + full_url + " " + opts)
+
+if "install" in sys.argv[1:]:
+    for name in repos.keys():
+        url, need_recursive, need_develop = repos[name]
+        # develop if needed
+        print("[installing " + name + "]...")
+        if need_develop:
+            os.chdir(os.path.join(current_path, name))
+            os.system("python3 setup.py develop")
+
+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")