aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-10-23 20:03:28 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-10-23 20:03:28 +0300
commitd12bea98c17f10f039ebb2331353c6ea794674cf (patch)
tree03314f0323a5b12c83eb05a1646f5ec58259c937
parenteclassdoc: remove @BUGREPORTS tag (diff)
downloadpkgcore-d12bea98c17f10f039ebb2331353c6ea794674cf.tar.gz
pkgcore-d12bea98c17f10f039ebb2331353c6ea794674cf.tar.bz2
pkgcore-d12bea98c17f10f039ebb2331353c6ea794674cf.zip
eclassdoc: output exported phases
Closes: https://bugs.gentoo.org/846503 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgcore/ebuild/eclass.py11
-rw-r--r--src/pkgcore/scripts/pmaint.py2
2 files changed, 12 insertions, 1 deletions
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: