Difficult-Rocket/gen_require.py

76 lines
1.9 KiB
Python
Raw Normal View History

2023-12-30 22:07:01 +08:00
import argparse
"""
# DR basic running from source
# DR build (by nuitka)
# DR contributing
"""
# fmt: off
basic = {
"images": [
2024-05-16 00:33:25 +08:00
'pillow >= 10.3.0; (platform_python_implementation == "PyPy" and '
'python_version < "3.10") or platform_python_implementation == "CPython"',
2023-12-30 22:07:01 +08:00
],
"sys info": [
2024-02-01 10:37:28 +08:00
"psutil >= 5.9.8"
2023-12-30 22:07:01 +08:00
],
"file read": [
"tomli >= 2.0.1",
2024-01-07 20:14:07 +08:00
"tomli-w >= 1.0.0",
2023-12-30 22:07:01 +08:00
"defusedxml >= 0.7.1"
],
}
build = {
"compile": [
2024-05-16 00:33:25 +08:00
"nuitka >= 2.2.2",
"imageio >= 2.34.1",
2023-12-30 22:07:01 +08:00
"setuptools >= 69",
2024-05-16 00:33:25 +08:00
"setuptools-rust >= 1.9.0",
"wheel >= 0.37.0",
2023-12-30 22:07:01 +08:00
]
}
dev = {
"debug": [
"objprint >= 0.2.3",
2024-05-16 00:33:25 +08:00
"viztracer >= 0.16.3; platform_python_implementation != \"PyPy\"",
"vizplugins >= 0.1.3; platform_python_implementation != \"PyPy\""
2023-12-30 22:07:01 +08:00
]
}
# fmt: on
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"type", help="type of genrating require", default=0, type=int, choices=[0, 1, 2]
)
2023-12-30 22:07:01 +08:00
args = parser.parse_args()
out = []
if args.type >= 0:
out.append("# DR basic running from source\n\n")
for tag, package in basic.items():
out.append(f"# for {tag}\n")
for p in package:
out.append(f"{p}\n")
out.append("\n")
if args.type >= 1:
out.append("# DR build (by nuitka)\n\n")
for tag, package in build.items():
out.append(f"# for {tag}\n")
for p in package:
out.append(f"{p}\n")
out.append("\n")
if args.type >= 2:
out.append("# DR contributing\n\n")
for tag, package in dev.items():
out.append(f"# for {tag}\n")
for p in package:
out.append(f"{p}\n")
print("".join(out))
2024-02-01 10:37:28 +08:00
2023-12-30 22:07:01 +08:00
with open("requirements.txt", "w") as f:
f.writelines(out)