Rename litex-data-XXX-YYY to pythondata-XXX-YYY
authorTim 'mithro' Ansell <me@mith.ro>
Mon, 6 Apr 2020 18:16:57 +0000 (11:16 -0700)
committerTim 'mithro' Ansell <me@mith.ro>
Sun, 12 Apr 2020 01:37:06 +0000 (18:37 -0700)
13 files changed:
litex/__init__.py
litex/data/__init__.py [deleted file]
litex/data/find.py [deleted file]
litex/soc/cores/cpu/blackparrot/core.py
litex/soc/cores/cpu/lm32/core.py
litex/soc/cores/cpu/microwatt/core.py
litex/soc/cores/cpu/mor1kx/core.py
litex/soc/cores/cpu/picorv32/core.py
litex/soc/cores/cpu/rocket/core.py
litex/soc/cores/cpu/vexriscv/core.py
litex/soc/integration/builder.py
litex_setup.py
setup.py

index 2454c0e796903000ed4b649386925770139b5baf..0499e31a802848ce7bf2421680a8e37ae1efcf48 100644 (file)
@@ -1,6 +1,3 @@
-# https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
-__path__ = __import__('pkgutil').extend_path(__path__, __name__)
-
 import sys
 
 # retro-compat 2019-09-30
@@ -12,3 +9,20 @@ from litex.soc.integration import export
 sys.modules["litex.soc.integration.cpu_interface"] = export
 
 from litex.tools.litex_client import RemoteClient
+
+def get_data_mod(data_type, data_name):
+    """Get the pythondata-{}-{} module or raise a useful error message."""
+    imp = "import pythondata_{}_{} as dm".format(data_type, data_name)
+    try:
+        l = {}
+        exec(imp, {}, l)
+        dm = l['dm']
+        return dm
+    except ImportError as e:
+        raise ImportError("""\
+pythondata-{dt}-{dn} module not installed! Unable to use {dn} {dt}.
+{e}
+
+You can install this by running;
+ pip install git+https://github.com/litex-hub/pythondata-{dt}-{dn}.git
+""".format(dt=data_type, dn=data_name, e=e))
diff --git a/litex/data/__init__.py b/litex/data/__init__.py
deleted file mode 100644 (file)
index c9b5ae9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
-__path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/litex/data/find.py b/litex/data/find.py
deleted file mode 100644 (file)
index 74c9109..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-def find_data(data_type, data_name):
-    imp = "from litex.data.{} import {} as dm".format(data_type, data_name)
-    try:
-        l = {}
-        exec(imp, {}, l)
-        dm = l['dm']
-        return dm.data_location
-    except ImportError as e:
-        raise ImportError("""\
-litex-data-{dt}-{dn} module not installed! Unable to use {dn} {dt}.
-{e}
-
-You can install this by running;
- pip install git+https://github.com/litex-hub/litex-data-{dt}-{dn}.git
-""".format(dt=data_type, dn=data_name, e=e))
index e55e6252bb2bb18d32fe0c958305a2e73168d00c..9f61c6c69101322771fe244fc00b7b8f4fc4772f 100644 (file)
@@ -32,7 +32,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import axi
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
@@ -116,7 +116,8 @@ class BlackParrotRV64(CPU):
 
     @staticmethod
     def add_sources(platform, variant="standard"):
-        filename = os.path.join(find_data("cpu", "blackparrot"), "flist_litex.verilator")
+        filename = get_data_mod("cpu", "blackparrot").data_file(
+            "flist_litex.verilator")
         with open(filename) as openfileobject:
             for line in openfileobject:
                 temp = line
index 75e7ba8cbea650e6881941fc2ea03c5e1815ea6e..ffa910d01bec790236ff29458dab8ab854186e76 100644 (file)
@@ -9,7 +9,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
 
@@ -97,7 +97,7 @@ class LM32(CPU):
 
     @staticmethod
     def add_sources(platform, variant):
-        vdir = find_data("cpu", "lm32")
+        vdir = get_data_mod("cpu", "lm32").data_location
         platform.add_sources(os.path.join(vdir, "rtl"),
             "lm32_cpu.v",
             "lm32_instruction_unit.v",
index aa00ee17239805fdeacba945144b466dfd1e7f73..d918d8b13b508d20f206929d7fd6edd01e81a8e1 100644 (file)
@@ -6,7 +6,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
 
@@ -99,7 +99,9 @@ class Microwatt(CPU):
 
     @staticmethod
     def add_sources(platform):
-        sdir = os.path.join(find_data("cpu", "microwatt"), "sources")
+        sdir = os.path.join(
+            get_data_mod("cpu", "microwatt").data_location,
+            "sources")
         platform.add_sources(sdir,
             # Common / Types / Helpers
             "decode_types.vhdl",
index a380e3faf9664e6962623c97331f38fe00b6493e..7c3d86a9b642c7e5b712428ff26087adb06cc11b 100644 (file)
@@ -8,7 +8,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
 
@@ -174,7 +174,8 @@ class MOR1KX(CPU):
     @staticmethod
     def add_sources(platform):
         vdir = os.path.join(
-            find_data("cpu", "mor1kx"), "rtl", "verilog")
+            get_data_mod("cpu", "mor1kx").data_location,
+            "rtl", "verilog")
         platform.add_source_dir(vdir)
         platform.add_verilog_include_path(vdir)
 
index 47017ac6b1789025801a6bdf91b61b5d561b29ab..b798e9dd76d532138508a78b86976620c2ca01bc 100644 (file)
@@ -11,7 +11,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
 
@@ -180,7 +180,7 @@ class PicoRV32(CPU):
 
     @staticmethod
     def add_sources(platform):
-        vdir = find_data("cpu", "picorv32")
+        vdir = get_data_mod("cpu", "picorv32").data_location
         platform.add_source(os.path.join(vdir, "picorv32.v"))
 
     def do_finalize(self):
index dff3fe70786f2aea3c118d320aa8edc74abacde8..c29a2796b2f8de01f73eb87c09a15f4299670024 100644 (file)
@@ -33,7 +33,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import axi
 from litex.soc.interconnect import wishbone
 from litex.soc.cores.cpu import CPU
@@ -239,7 +239,7 @@ class RocketRV64(CPU):
 
     @staticmethod
     def add_sources(platform, variant="standard"):
-        vdir = find_data("cpu", "rocket")
+        vdir = get_data_mod("cpu", "rocket").data_location
         platform.add_sources(
             os.path.join(vdir, "generated-src"),
             CPU_VARIANTS[variant] + ".v",
index 42328d1998546b3474e722a3db080a0b21c1b7da..157b948a3e24ac266a80a3f958b076b94c391376 100644 (file)
@@ -12,7 +12,7 @@ import os
 
 from migen import *
 
-from litex.data.find import find_data
+from litex import get_data_mod
 from litex.soc.interconnect import wishbone
 from litex.soc.interconnect.csr import *
 from litex.soc.cores.cpu import CPU
@@ -247,7 +247,7 @@ class VexRiscv(CPU, AutoCSR):
     @staticmethod
     def add_sources(platform, variant="standard"):
         cpu_filename = CPU_VARIANTS[variant] + ".v"
-        vdir = find_data("cpu", "vexriscv")
+        vdir = get_data_mod("cpu", "vexriscv").data_location
         platform.add_source(os.path.join(vdir, cpu_filename))
 
     def use_external_variant(self, variant_filename):
index 80cc3753a71bb62ea46748e9eb86323b8e1cdfa0..745eb75e921dc6d7e023ead7fee0427fd6fca1b7 100644 (file)
@@ -14,8 +14,8 @@ import subprocess
 import struct
 import shutil
 
+from litex import get_data_mod
 from litex.build.tools import write_to_file
-from litex.data.find import find_data
 from litex.soc.integration import export, soc_core
 
 __all__ = ["soc_software_packages", "soc_directory",
@@ -102,7 +102,8 @@ class Builder:
             for k, v in exec_profiles.items():
                 define(k, v)
             define(
-                "COMPILER_RT_DIRECTORY", find_data("software", "compiler_rt"))
+                "COMPILER_RT_DIRECTORY",
+                get_data_mod("software", "compiler_rt").data_location)
             define("SOC_DIRECTORY", soc_directory)
             variables_contents.append("export BUILDINC_DIRECTORY\n")
             define("BUILDINC_DIRECTORY", self.include_dir)
index be9c3b432d377d8e1ce1c08302d2a0bf400de1b8..82259f1a1bda912a253fd1e38476575b8085336c 100755 (executable)
@@ -19,7 +19,7 @@ repos = [
     ("migen",        ("https://github.com/m-labs/",        True,  True)),
 
     # LiteX SoC builder
-    ('litex-data-software-compiler_rt', ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-software-compiler_rt", ("https://github.com/litex-hub/", False, True)),
     ("litex",        ("https://github.com/enjoy-digital/", False,  True)),
 
     # LiteX cores ecosystem
@@ -38,14 +38,14 @@ repos = [
     ("litex-boards", ("https://github.com/litex-hub/",     False, True)),
 
     # Optional LiteX data
-    ("litex-data-cpu-blackparrot", ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-mor1kx",      ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-lm32",        ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-microwatt",   ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-picorv32",    ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-rocket",      ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-cpu-vexriscv",    ("https://github.com/litex-hub/", False, True)),
-    ("litex-data-misc-tapcfg",     ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-blackparrot", ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-mor1kx",      ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-lm32",        ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-microwatt",   ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-picorv32",    ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-rocket",      ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-cpu-vexriscv",    ("https://github.com/litex-hub/", False, True)),
+    ("pythondata-misc-tapcfg",     ("https://github.com/litex-hub/", False, True)),
 ]
 repos = OrderedDict(repos)
 
index 9c7444270c82bed5e66373bbbcfd87946ddbf1bb..496c65d64c153e1aa8660ef0c6f7a3a6e4a391f4 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ setup(
     install_requires=[
         "migen",
         "pyserial",
-        "litex-data-software-compiler_rt",
+        "pythondata-software-compiler_rt",
     ],
     packages=find_packages(exclude=("test*", "sim*", "doc*")),
     include_package_data=True,