Difficult-Rocket/gen_require.py

72 lines
1.8 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": [
'pillow >= 10.1.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"',
],
"sys info": [
"psutil >= 5.9.7"
],
"file read": [
"tomli >= 2.0.1",
"tomlkit >= 0.12.3",
"defusedxml >= 0.7.1"
],
}
build = {
"compile": [
"nuitka >= 1.9.5",
"imageio >= 2.33.1",
"setuptools >= 69",
"setuptools-rust >= 1.8.1"
]
}
dev = {
"debug": [
"objprint >= 0.2.3",
"viztracer >= 0.16.0; platform_python_implementation != \"PyPy\"",
"vizplugin >= 0.1.3; platform_python_implementation != \"PyPy\""
]
}
# 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])
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))
with open("requirements.txt", "w") as f:
f.writelines(out)