diff --git a/Coriolis/__init__.py b/Coriolis/__init__.py index 3e8ca850..49e03f5b 100644 --- a/Coriolis/__init__.py +++ b/Coriolis/__init__.py @@ -1,7 +1,33 @@ #This is needed for poetry to recognise the top level module import os +import sys +import subprocess -__all__ = ["crlcore"] +#TODO not PEP302 complient -probably a big porting job coriolis_package_dir = os.path.abspath(os.path.dirname(__file__)) os.environ["CORIOLIS_TOP"] = coriolis_package_dir +CORIOLIS_DATA = os.path.join(os.path.dirname(__file__), 'data') +CORIOLIS_BIN = os.path.join(CORIOLIS_DATA,"bin") + +def _program(name, args): + return subprocess.call([os.path.join(CORIOLIS_BIN, name)] + args, close_fds=False) + +def blif2vst(): + raise SystemExit(_program("blif2vst.py", sys.argv[1:])) + +def cx2y(): + raise SystemExit(_program("cx2y", sys.argv[1:])) + +def cyclop(): + raise SystemExit(_program("cyclop", sys.argv[1:])) + +def tutorial(): + raise SystemExit(_program("tutorial", sys.argv[1:])) + +def unittests(): + raise SystemExit(_program("unittests", sys.argv[1:])) + +def yosys_coriolis(): + raise SystemExit(_program("yosys.py", sys.argv[1:])) + diff --git a/build.py b/build.py index c77e4eed..6bd5601a 100644 --- a/build.py +++ b/build.py @@ -5,6 +5,7 @@ import subprocess import sys import sysconfig from distutils.version import LooseVersion +from distutils.dir_util import copy_tree from typing import Any, Dict from setuptools.command.build_ext import build_ext @@ -89,7 +90,7 @@ class ExtensionBuilder(build_ext): subprocess.check_call(["cmake", "--debug-find", "--trace-redirect=build.cmake.trace", "--trace-expand", ext.sourcedir] + cmake_args, cwd=build_dir, env=env) subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=build_dir) subprocess.check_call(["cmake", "--install", ".", "--prefix", extdir] + install_args, cwd=build_dir) - + copy_tree(os.path.join(extdir, "bin"), "Coriolis/data/bin") def build(setup_kwargs: Dict[str, Any]) -> None: cmake_modules = [ diff --git a/pyproject.toml b/pyproject.toml index a12220d5..2ba3bd17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,15 @@ python = "^3.8" ninja = ">=1.10" cmake = ">=3" +[tool.poetry.scripts] + +blif2vst = 'Coriolis:blif2vst' +cx2y = 'Coriolis:cx2y' +cyclop = 'Corilis:cyclop' +tutorial = 'Coriolis:tutorial' +unittests = 'Coriolis:unittests' +yosys_coriolis = 'Coriolis:yosys_coriolis' + [build-system] requires = ["poetry-core", "setuptools", "cmake"] build-backend = "poetry.core.masonry.api"