-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·75 lines (60 loc) · 2.32 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
#!/usr/bin/env python3
from setuptools import setup
from setuptools.dist import Distribution
# Hack to get version number since it's considered bad practice to import your
# own package in setup.py. This call defines keys 'version', 'authors', and
# 'banner' in the `metadata` dict.
metadata = {}
with open('surelog/__init__.py') as f:
exec(f.read(), metadata)
with open("README.md", "r", encoding="utf-8") as readme:
long_desc = readme.read()
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
install_reqs, extras_req = parse_reqs()
# Hack to force cibuildwheels to build a pure python package
# https://stackoverflow.com/a/36886459
class BinaryDistribution(Distribution):
"""Distribution which always forces a binary package with platform name"""
def has_ext_modules(foo):
return True
setup(
name="sc-surelog",
description="Precompiled binary for surelog.",
long_description=long_desc,
long_description_content_type="text/markdown",
license='Apache License 2.0',
author="ZeroASIC",
author_email="gadfort@zeroasic.com",
url="https://github.com/siliconcompiler/sc-surelog",
project_urls={
"Source Code": "https://github.com/siliconcompiler/sc-surelog",
"Bug Tracker": "https://github.com/siliconcompiler/sc-surelog/issues"
},
version=metadata['__version__'],
packages=['surelog'],
include_package_data=True,
python_requires=">=3.8",
install_requires=install_reqs,
extras_require=extras_req,
distclass=BinaryDistribution
)