-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
88 lines (78 loc) · 2.43 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
import re
from pathlib import Path
from typing import Mapping, cast
from setuptools import Command, find_packages, setup
import versioneer
# 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: list[str] = []
for ir in required:
if ir[0:3] == "git":
name = ir.split("/")[-1]
reqs += [f"{name} @ {ir}@main"]
else:
reqs += [ir]
extras_require = {}
for mreqs, mode in zip(
[
optionals,
],
[
"extras",
],
):
opt_reqs: list[str] = []
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=cast(str, versioneer.get_version()),
cmdclass=cast(Mapping[str, type[Command]], 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",
"irdl-to-pyrdl = xdsl.tools.irdl_to_pyrdl:main",
"xdsl-run = xdsl.tools.xdsl_run: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="[email protected]",
license="MIT",
packages=find_packages(),
package_data={"xdsl": ["py.typed"]},
install_requires=reqs,
extras_require=extras_require,
zip_safe=False,
)