From ad18b9263bc24806f601b4f3a770779a8451e7a1 Mon Sep 17 00:00:00 2001 From: Fischer Moseley <42497969+fischermoseley@users.noreply.github.com> Date: Tue, 14 Feb 2023 20:53:36 -0500 Subject: [PATCH] i hate python packaging but everything works now --- .gitignore | 1 + pyproject.toml | 30 ++++++++----------- src/__init__.py | 0 src/{manta.py => manta/__init__.py} | 22 ++++++++------ src/manta/__main__.py | 2 ++ src/{hdl => manta}/fifo.sv | 0 src/{hdl => manta}/manta_template.sv | 0 src/{hdl => manta}/uart_rx.sv | 0 src/{hdl => manta}/uart_tx.sv | 0 src/{hdl => manta}/uplink.sv | 0 ...nx_true_dual_port_read_first_2_clock_ram.v | 0 11 files changed, 29 insertions(+), 26 deletions(-) delete mode 100644 src/__init__.py rename src/{manta.py => manta/__init__.py} (95%) create mode 100644 src/manta/__main__.py rename src/{hdl => manta}/fifo.sv (100%) rename src/{hdl => manta}/manta_template.sv (100%) rename src/{hdl => manta}/uart_rx.sv (100%) rename src/{hdl => manta}/uart_tx.sv (100%) rename src/{hdl => manta}/uplink.sv (100%) rename src/{hdl => manta}/xilinx_true_dual_port_read_first_2_clock_ram.v (100%) diff --git a/.gitignore b/.gitignore index a033f23..2b760e1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.vcd *.out dist/ +*.egg-info \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 0697d7c..8a9f055 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,35 +1,31 @@ -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - [project] -name = "manta" -version = "0.0.0" +name = "mantaray" +version = "0.0.4" authors = [ { name="Fischer Moseley", email="fischerm@mit.edu" }, ] description = "An In-Situ Debugging Tool for Programmable Hardware" readme = "README.md" dependencies = [ - 'PyYAML', - 'pyserial', - 'pyvcd', + "PyYAML", + "pyserial", + "pyvcd", ] requires-python = ">=3.7" -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Operating System :: OS Independent", - "Development Status :: 2 - Pre-Alpha", -] [project.urls] "Homepage" = "https://github.com/fischermoseley/manta" -"Bug Tracker" = "https://github.com/fischermoseley/manta/issues" + +[project.scripts] +manta = "manta:main" [tool.setuptools.packages.find] where = ["src"] [tool.setuptools.package-data] -mypkg = ["*.sv", "*.v"] \ No newline at end of file +manta = ["*.sv", "*.v"] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/manta.py b/src/manta/__init__.py similarity index 95% rename from src/manta.py rename to src/manta/__init__.py index 5b527a4..dca1e1b 100644 --- a/src/manta.py +++ b/src/manta/__init__.py @@ -11,16 +11,16 @@ debug = True version = "0.0.0" -def load_source_files(path): - """concatenates the contents of the list of files provided into a single string""" +def load_source_files(): + """loads source files and returns a string of their contents concatenated together""" - downlink_template = pkgutil.get_data(__name__, "hdl/manta_template.sv") - downlink_template += pkgutil.get_data(__name__, "hdl/fifo.sv") - downlink_template += pkgutil.get_data(__name__, "hdl/uart_tx.sv") - downlink_template += pkgutil.get_data(__name__, "hdl/uart_rx.sv") + downlink_template = pkgutil.get_data(__name__, "manta_template.sv").decode() + downlink_template += pkgutil.get_data(__name__, "fifo.sv").decode() + downlink_template += pkgutil.get_data(__name__, "uart_tx.sv").decode() + downlink_template += pkgutil.get_data(__name__, "uart_rx.sv").decode() downlink_template += pkgutil.get_data( __name__, "hdl/xilinx_true_dual_port_read_first_2_clock_ram.v" - ) + ).decode() return downlink_template @@ -113,7 +113,7 @@ def check_config(config): def gen_downlink_core(config): - buf = downlink_template + buf = load_source_files() dl = config["downlink"] # add timestamp @@ -325,7 +325,7 @@ def export_waveform(config, data, path): raise NotImplementedError("More file formats to come!") -if __name__ == "__main__": +def main(): # print help menu if no args passed or help menu requested if len(argv) == 1 or argv[1] == "help" or argv[1] == "ray" or argv[1] == "bae": print_help() @@ -373,3 +373,7 @@ if __name__ == "__main__": else: print("Option not recognized.") print_help() + + +if __name__ == "__main__": + main() diff --git a/src/manta/__main__.py b/src/manta/__main__.py new file mode 100644 index 0000000..d0993d1 --- /dev/null +++ b/src/manta/__main__.py @@ -0,0 +1,2 @@ +import manta +manta.main() \ No newline at end of file diff --git a/src/hdl/fifo.sv b/src/manta/fifo.sv similarity index 100% rename from src/hdl/fifo.sv rename to src/manta/fifo.sv diff --git a/src/hdl/manta_template.sv b/src/manta/manta_template.sv similarity index 100% rename from src/hdl/manta_template.sv rename to src/manta/manta_template.sv diff --git a/src/hdl/uart_rx.sv b/src/manta/uart_rx.sv similarity index 100% rename from src/hdl/uart_rx.sv rename to src/manta/uart_rx.sv diff --git a/src/hdl/uart_tx.sv b/src/manta/uart_tx.sv similarity index 100% rename from src/hdl/uart_tx.sv rename to src/manta/uart_tx.sv diff --git a/src/hdl/uplink.sv b/src/manta/uplink.sv similarity index 100% rename from src/hdl/uplink.sv rename to src/manta/uplink.sv diff --git a/src/hdl/xilinx_true_dual_port_read_first_2_clock_ram.v b/src/manta/xilinx_true_dual_port_read_first_2_clock_ram.v similarity index 100% rename from src/hdl/xilinx_true_dual_port_read_first_2_clock_ram.v rename to src/manta/xilinx_true_dual_port_read_first_2_clock_ram.v