scripts: sphinx-pre-install: only show portage hints once

On gentoo, doesn't repeat instructions about how to enable
portage.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/d4e7ef1d5e1f0412eb9f9ae4913dc64c0821e002.1754992972.git.mchehab+huawei@kernel.org
This commit is contained in:
Mauro Carvalho Chehab 2025-08-12 17:52:29 +02:00 committed by Jonathan Corbet
parent 94a161d998
commit 12bdcf8989

View file

@ -89,6 +89,9 @@ class SphinxDependencyChecker:
self.python_cmd = ""
self.activate_cmd = ""
# Certain hints are meant to be shown only once
self.first_hint = True
self.min_version = (0, 0, 0)
self.cur_version = (0, 0, 0)
self.latest_avail_ver = (0, 0, 0)
@ -714,11 +717,14 @@ class SphinxDependencyChecker:
"media-gfx/graphviz",
]
for p in portages:
result = self.run(["grep", p, "/etc/portage/package.use/*"],
stdout=subprocess.PIPE, text=True)
if not result.stdout.strip():
print(f"\tsudo emerge -av1 {p}")
if self.first_hint:
for p in portages:
result = self.run(["grep", p, "/etc/portage/package.use/*"],
stdout=subprocess.PIPE, text=True)
if not result.stdout.strip():
print(f"\tsudo emerge -av1 {p}")
self.first_hint = False
print(f"\tsudo emerge --ask {self.install}")