Debian Codegraph @

third_party/python/aiohttp/requirements/sync-direct-runtime-deps.py

raw
1 #!/usr/bin/env python
2 """Sync direct runtime dependencies from setup.cfg to runtime-deps.in."""
3
4 from configparser import ConfigParser
5 from pathlib import Path
6
7 cfg = ConfigParser()
8 cfg.read(Path("setup.cfg"))
9 reqs = cfg["options"]["install_requires"] + cfg.items("options.extras_require")[0][1]
10 reqs = sorted(reqs.split("\n"), key=str.casefold)
11 reqs.remove("")
12
13 with open(Path("requirements", "runtime-deps.in"), "w") as outfile:
14 header = "# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`\n\n"
15 outfile.write(header)
16 outfile.write("\n".join(reqs) + "\n")