forked from xdslproject/xdsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
79 lines (71 loc) · 2.18 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
import versioneer
from setuptools import find_packages, setup
from pathlib import Path
import re
# Add README.md as long description
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
git_regex = r"git\+(?P<url>https:\/\/github.com\/[\w]+\/[\w]+\.git)(@(?P<version>[\w]+))?(#egg=(?P<name>[\w]+))?"
with open("requirements.txt") as f:
required = f.read().splitlines()
with open("requirements-optional.txt") as f:
optionals = f.read().splitlines()
reqs = []
for ir in required:
if ir[0:3] == "git":
name = ir.split("/")[-1]
reqs += ["%s @ %s@main" % (name, ir)]
else:
reqs += [ir]
extras_require = {}
for mreqs, mode in zip(
[
optionals,
],
[
"extras",
],
):
opt_reqs = []
for ir in mreqs:
# For conditionals like pytest=2.1; python == 3.6
if ";" in ir:
entries = ir.split(";")
extras_require[entries[1]] = entries[0]
elif ir[0:3] == "git":
m = re.match(git_regex, ir)
assert m is not None
items = m.groupdict()
name = items["name"]
url = items["url"]
version = items.get("version")
if version is None:
version = "main"
opt_reqs += [f"{name} @ git+{url}@{version}"]
else:
opt_reqs += [ir]
extras_require[mode] = opt_reqs
setup(
name="xdsl",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="xDSL",
long_description=long_description,
long_description_content_type="text/markdown",
entry_points={"console_scripts": ["xdsl-opt = xdsl.tools.xdsl_opt:main"]},
project_urls={
"Source Code": "https://github.com/xdslproject/xdsl",
"Issue Tracker": "https://github.com/xdslproject/xdsl/issues",
},
url="https://xdsl.dev/",
platforms=["Linux", "Mac OS-X", "Unix"],
test_suite="pytest",
author="Mathieu Fehr",
author_email="mathieu.fehr@ed.ac.uk",
license="MIT",
packages=find_packages(),
package_data={"xdsl": ["py.typed"]},
install_requires=reqs,
extras_require=extras_require,
zip_safe=False,
)