From d12bea98c17f10f039ebb2331353c6ea794674cf Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Mon, 23 Oct 2023 20:03:28 +0300 Subject: eclassdoc: output exported phases Closes: https://bugs.gentoo.org/846503 Signed-off-by: Arthur Zamarin --- src/pkgcore/ebuild/eclass.py | 11 +++++++++++ src/pkgcore/scripts/pmaint.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pkgcore/ebuild/eclass.py b/src/pkgcore/ebuild/eclass.py index 4612d0b3..9859f657 100644 --- a/src/pkgcore/ebuild/eclass.py +++ b/src/pkgcore/ebuild/eclass.py @@ -590,6 +590,17 @@ class EclassDoc(AttrDict): rst.append(self.example) rst.append("") + raw_eclass_name = self.name[: -len(".eclass")] + latest_eapi = EAPI.known_eapis[sorted(EAPI.known_eapis)[-1]] + if exported_phases := [ + x + for x in latest_eapi.phases.values() + if f"{raw_eclass_name}_{x}" in self.exported_function_names + ]: + rst.extend(_rst_header("-", "Exported Phases")) + rst.extend(f"- ``{phase}``" for phase in exported_phases) + rst.append("") + if external_funcs := [x for x in self.functions if not x.internal]: rst.extend(_header_only("-", "Functions")) for func in external_funcs: diff --git a/src/pkgcore/scripts/pmaint.py b/src/pkgcore/scripts/pmaint.py index bc930cc0..390f7b28 100644 --- a/src/pkgcore/scripts/pmaint.py +++ b/src/pkgcore/scripts/pmaint.py @@ -544,7 +544,7 @@ def _eclass_main(options, out, err): with open( pjoin(options.output_dir, f"{os.path.basename(path)}.{ext}"), "wt" ) as f: - obj = EclassDoc(path) + obj = EclassDoc(path, sourced=True) convert_func = getattr(obj, f"to_{options.format}") f.write(convert_func()) except ValueError as e: -- cgit v1.2.3-65-gdbad