-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsetup.py
94 lines (77 loc) · 3.02 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Setup script for the Switchboard Python module
# Copyright (c) 2024 Zero ASIC Corporation
# This code is licensed under Apache License 2.0 (see LICENSE for details)
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext
__version__ = "0.2.20"
#################################################################################
# parse_reqs, long_desc from https://github.com/siliconcompiler/siliconcompiler #
#################################################################################
def parse_reqs():
'''Parse out each requirement category from requirements.txt'''
install_reqs = []
extras_reqs = {}
current_section = None # default to install
with open('requirements.txt', 'r') as reqs_file:
for line in reqs_file.readlines():
line = line.rstrip('\n')
if line.startswith('#:'):
# strip off '#:' prefix to read extras name
current_section = line[2:]
if current_section not in extras_reqs:
extras_reqs[current_section] = []
elif not line or line.startswith('#'):
# skip blanks and comments
continue
elif current_section is None:
install_reqs.append(line)
else:
extras_reqs[current_section].append(line)
return install_reqs, extras_reqs
with open("README.md", "r", encoding="utf-8") as readme:
long_desc = readme.read()
########################################################################
########################################################################
# the pybind module is built as _switchboard that is imported
# into the module called "switchboard". this will allow us
# to implement some features in pure Python in the future
ext_modules = [
Pybind11Extension(
"_switchboard",
["python/switchboard_pybind.cc"],
include_dirs=['switchboard/cpp']
),
]
# determine installation requirements
install_reqs, extras_req = parse_reqs()
setup(
name="switchboard-hw",
description="A low-latency communication library for RTL simulation and emulation.",
long_description=long_desc,
long_description_content_type="text/markdown",
license='Apache License 2.0',
author="Zero ASIC",
url="https://github.com/zeroasiccorp/switchboard",
project_urls={
"Documentation": "https://zeroasiccorp.github.io/switchboard/",
"Bug Tracker": "https://github.com/zeroasiccorp/switchboard/issues"
},
version=__version__,
packages=find_packages(),
include_package_data=True,
python_requires=">=3.7",
install_requires=install_reqs,
extras_require=extras_req,
ext_modules=ext_modules,
entry_points={
'console_scripts': [
'sbtcp=switchboard.sbtcp:main',
'switchboard=switchboard.switchboard:main'
],
'pytest11': [
'switchboard=switchboard.pytest_plugin'
]
},
cmdclass={"build_ext": build_ext},
zip_safe=False,
)