weblate/scripts/show-extras
Michal Čihař a4f5c066bc feat: add Graylog integration
- added gelf extra to install gelf logging backend
- add environment configuration to Docker image
- add example configuration in weblate/settings_example.py
2024-12-07 13:00:18 +01:00

42 lines
1 KiB
Python
Executable file

#!/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
.. list-table:: Optional dependencies
:header-rows: 1
* - pip extra
- 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"| `{dependency} <https://pypi.org/project/{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()