mirror of
https://github.com/WeblateOrg/weblate.git
synced 2026-07-26 14:23:58 +08:00
39 lines
1 KiB
Python
Executable file
Vendored
39 lines
1 KiB
Python
Executable file
Vendored
#!/usr/bin/env python
|
|
|
|
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import re
|
|
import tomllib
|
|
|
|
print(
|
|
"""
|
|
.. Table is generated using scripts/show-extras.py
|
|
|
|
.. list-table:: Optional dependencies
|
|
:header-rows: 1
|
|
|
|
* - Optional dependency specifier
|
|
- Python packages
|
|
- Weblate feature
|
|
"""
|
|
)
|
|
indent = " "
|
|
|
|
with open("pyproject.toml", "rb") as handle:
|
|
toml_dict = tomllib.load(handle)
|
|
|
|
for section, data in toml_dict["project"]["optional-dependencies"].items():
|
|
if section == "all":
|
|
continue
|
|
# Section name
|
|
print(f"{indent}* - ``{section}``")
|
|
# Actual dependencies
|
|
dependencies = [re.split(r"[;<>=[]", dependency)[0].strip() for dependency in data]
|
|
dependencies_links = [f"| :pypi:`{dependency}`" for dependency in dependencies]
|
|
dependencies_str = f"\n{indent} ".join(dependencies_links)
|
|
print(f"{indent} - {dependencies_str}")
|
|
# Placeholder for description
|
|
print(f"{indent} -")
|
|
print()
|