Add bin files as scripts

This commit is contained in:
Robert Taylor 2022-12-02 01:04:37 +00:00 committed by Jean-Paul Chaput
parent 5a669c4641
commit df78c3ab48
3 changed files with 38 additions and 2 deletions

View File

@ -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:]))

View File

@ -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 = [

View File

@ -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"