mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-17 22:32:31 -05:00
feat: add contributor credits to pack readme
This commit is contained in:
@@ -758,6 +758,7 @@ def _build_readme(
|
|||||||
total_files: int,
|
total_files: int,
|
||||||
num_systems: int,
|
num_systems: int,
|
||||||
source: str = "full",
|
source: str = "full",
|
||||||
|
contributors: list[dict] | None = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Build a personalized step-by-step README for each platform pack."""
|
"""Build a personalized step-by-step README for each platform pack."""
|
||||||
sep = "=" * 50
|
sep = "=" * 50
|
||||||
@@ -971,7 +972,18 @@ def _build_readme(
|
|||||||
" Independent of platform scraper accuracy.\n\n"
|
" Independent of platform scraper accuracy.\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
return header + source_info + guide + footer
|
credits = ""
|
||||||
|
if contributors:
|
||||||
|
credits = "\nCONTRIBUTORS\n\n"
|
||||||
|
for cb in contributors:
|
||||||
|
username = cb.get("username", "")
|
||||||
|
contribution = cb.get("contribution", "")
|
||||||
|
pr = cb.get("pr")
|
||||||
|
pr_ref = f" (#{pr})" if pr else ""
|
||||||
|
credits += f" @{username} - {contribution}{pr_ref}\n"
|
||||||
|
credits += "\n"
|
||||||
|
|
||||||
|
return header + source_info + guide + credits + footer
|
||||||
|
|
||||||
|
|
||||||
def _build_agnostic_rename_readme(
|
def _build_agnostic_rename_readme(
|
||||||
@@ -1482,9 +1494,15 @@ def generate_pack(
|
|||||||
|
|
||||||
# README.txt for users -personalized step-by-step per platform
|
# README.txt for users -personalized step-by-step per platform
|
||||||
num_systems = len(pack_systems)
|
num_systems = len(pack_systems)
|
||||||
|
_registry_path = Path(platforms_dir) / "_registry.yml"
|
||||||
|
_pack_registry: dict = {}
|
||||||
|
if _registry_path.exists():
|
||||||
|
with open(_registry_path) as _rf:
|
||||||
|
_pack_registry = (yaml.safe_load(_rf) or {}).get("platforms", {})
|
||||||
readme_text = _build_readme(
|
readme_text = _build_readme(
|
||||||
platform_name, platform_display, base_dest, total_files, num_systems,
|
platform_name, platform_display, base_dest, total_files, num_systems,
|
||||||
source=source,
|
source=source,
|
||||||
|
contributors=_pack_registry.get(platform_name, {}).get("contributed_by", []),
|
||||||
)
|
)
|
||||||
zf.writestr("README.txt", readme_text)
|
zf.writestr("README.txt", readme_text)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user