-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
68 lines (61 loc) · 2.3 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
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext
import subprocess
import shutil
from pathlib import Path
name = 'svinst'
version = '0.1.9'
DESCRIPTION = '''\
Python library for parsing module definitions and instantiations from SystemVerilog files\
'''
class SvInstBuild(build_ext):
def run(self):
# get path to the directory where binaries should be installed
ext = self.extensions[0]
extdir = Path(self.get_ext_fullpath(ext.name)).resolve().parent
extdir = extdir / 'svinst'
extdir.mkdir(parents=True, exist_ok=True)
# install the binary to the python package directory
if shutil.which('cargo') is not None:
subprocess.run(['cargo', 'install', 'svinst', '--root', str(extdir)])
else:
raise Exception('Rust is needed to build this package. Please install it from https://www.rust-lang.org/tools/install')
with open('README.md', 'r') as fh:
LONG_DESCRIPTION = fh.read()
setup(
name=name,
version=version,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
keywords = ['verilog', 'system-verilog', 'system verilog', 'parse', 'parser', 'parsing', 'module', 'modules',
'definition', 'definitions', 'instantation', 'instantiations'],
packages=find_packages(exclude=['tests']),
license='MIT',
url=f'https://github.com/sgherbst/{name}',
author='Steven Herbst',
author_email='[email protected]',
python_requires='>=3.7',
download_url = f'https://github.com/sgherbst/{name}/archive/v{version}.tar.gz',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
'License :: OSI Approved :: MIT License',
f'Programming Language :: Python :: 3.7'
],
include_package_data=True,
zip_safe=False,
# create command-line script to run svinst binary
entry_points={
'console_scripts': [
'svinst=svinst.svinst:main'
]
},
install_requires=[
'PyYAML'
],
# configure building of svinst binary
ext_modules=[Extension('svinst', [])],
cmdclass=dict(build_ext=SvInstBuild)
)