From nobody Tue Oct 7 14:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B0202E6D08; Wed, 9 Jul 2025 13:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752069142; cv=none; b=ZnpUolnOqjcWhTZA8quoHIBOTYYHd8lkPUch+nv7ruR8e7Pd7dNOHOGAqPWPGmgQvKJZkankYRZmnBlKTRQGeIDTqkqll38NMmbvs4JiBX+jhivSke+5rrRxSbWnr4Z2aDgzWaUV0MdoudPDrYASE6WyYPAOC12Wm/xTVVZh5BQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752069142; c=relaxed/simple; bh=QTYVPi5+QHYNlWAjLlwESsHYWhntymHRulFXntyK2Ao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WeMSlRF+HrGN7WZTSxpMWzuo5jhZnA9yr2AGbI2Xexh+Gz+4iuXguhq722TG1umh7lJiZJEndPqS7wf7Ke8QcVk7kq4594MkqwjuVb+yNDjUe4Zm/o2C3oK9ZsEU+l9cCHF5DoZdrQ1EOgfhjLPjRixlFtA840ciBWR7Rnj4e6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j612QRsW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j612QRsW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCBA5C4CEF8; Wed, 9 Jul 2025 13:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752069141; bh=QTYVPi5+QHYNlWAjLlwESsHYWhntymHRulFXntyK2Ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j612QRsWx48p2RmEwVw4V78JHpb7j1E5lUslmENJznu/IINFtAsBrLyu6jcYECrf2 MEumM0KFPc43kxIVTi8DLn8476dzHluDF/j9vTUPBtGWROLYgLF43XQdg9BaCwBjnD fw7Hd7A8edE6/g+n6wfAva7JqJ6VEcf3YXRxp2eh5gwVdTcNiyeUgmm4BWtE3AL6dY qFFnOENBJyaV0z3kbSYjvQhKhF2+GAjwo99RvQkX6oD42l64kAhyfkHmdsLxSNadWT guN0nxTLARrmlC+cxYT8dY1yHRkXnigzPRity+n/lIGq4p/Aoyq1yjbCC5XKT80686 kFfzsUsyTjz6w== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uZVDd-00000000EDP-2uMQ; Wed, 09 Jul 2025 15:52:17 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 27/39] scripts: sphinx-pre-install: move ancillary checkers to a separate class Date: Wed, 9 Jul 2025 15:51:59 +0200 Message-ID: <335809ee3f373a2f4193be259c3f0bf769f4c0b9.1752067814.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The code there are just a bunch of static functions that are used by the main class. group them altogether to better organize the code. Signed-off-by: Mauro Carvalho Chehab --- scripts/sphinx-pre-install.py | 160 +++++++++++++++++----------------- 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py index 47dce1fcddfb..b00e50028f4d 100755 --- a/scripts/sphinx-pre-install.py +++ b/scripts/sphinx-pre-install.py @@ -150,85 +150,11 @@ class DepManager: if output_msg: print(f"\n{output_msg}\n") =20 -class SphinxDependencyChecker: - # List of required texlive packages on Fedora and OpenSuse - texlive =3D { - "amsfonts.sty": "texlive-amsfonts", - "amsmath.sty": "texlive-amsmath", - "amssymb.sty": "texlive-amsfonts", - "amsthm.sty": "texlive-amscls", - "anyfontsize.sty": "texlive-anyfontsize", - "atbegshi.sty": "texlive-oberdiek", - "bm.sty": "texlive-tools", - "capt-of.sty": "texlive-capt-of", - "cmap.sty": "texlive-cmap", - "ctexhook.sty": "texlive-ctex", - "ecrm1000.tfm": "texlive-ec", - "eqparbox.sty": "texlive-eqparbox", - "eu1enc.def": "texlive-euenc", - "fancybox.sty": "texlive-fancybox", - "fancyvrb.sty": "texlive-fancyvrb", - "float.sty": "texlive-float", - "fncychap.sty": "texlive-fncychap", - "footnote.sty": "texlive-mdwtools", - "framed.sty": "texlive-framed", - "luatex85.sty": "texlive-luatex85", - "multirow.sty": "texlive-multirow", - "needspace.sty": "texlive-needspace", - "palatino.sty": "texlive-psnfss", - "parskip.sty": "texlive-parskip", - "polyglossia.sty": "texlive-polyglossia", - "tabulary.sty": "texlive-tabulary", - "threeparttable.sty": "texlive-threeparttable", - "titlesec.sty": "texlive-titlesec", - "ucs.sty": "texlive-ucs", - "upquote.sty": "texlive-upquote", - "wrapfig.sty": "texlive-wrapfig", - } - - def __init__(self, args): - self.pdf =3D args.pdf - self.virtualenv =3D args.virtualenv - self.version_check =3D args.version_check - - self.deps =3D DepManager(self.pdf) - - self.need_symlink =3D 0 - self.need_sphinx =3D 0 - self.need_pip =3D 0 - self.rec_sphinx_upgrade =3D 0 - self.verbose_warn_install =3D 1 - - self.system_release =3D "" - self.install =3D "" - self.virtenv_dir =3D "" - self.python_cmd =3D "" - self.activate_cmd =3D "" - - # Some distros may not have a Sphinx shipped package compatible wi= th - # our minimal requirements - self.package_supported =3D True - - # Recommend a new python version - self.recommend_python =3D None - - # Certain hints are meant to be shown only once - self.first_hint =3D True - - self.min_version =3D (0, 0, 0) - self.cur_version =3D (0, 0, 0) - self.latest_avail_ver =3D (0, 0, 0) - self.venv_ver =3D (0, 0, 0) - - prefix =3D os.environ.get("srctree", ".") + "/" - - self.conf =3D prefix + "Documentation/conf.py" - self.requirement_file =3D prefix + "Documentation/sphinx/requireme= nts.txt" - self.virtenv_prefix =3D ["sphinx_", "Sphinx_" ] - - # - # Ancillary methods that don't depend on self - # +class AncillaryCheckers: + """ + Ancillary methods that checks for missing dependencies for different + types of types, like binaries, python modules, rpm deps, etc. + """ =20 @staticmethod def which(prog): @@ -335,6 +261,82 @@ class SphinxDependencyChecker: =20 return subprocess.run(*args, **kwargs) =20 +class SphinxDependencyChecker(AncillaryCheckers): + # List of required texlive packages on Fedora and OpenSuse + texlive =3D { + "amsfonts.sty": "texlive-amsfonts", + "amsmath.sty": "texlive-amsmath", + "amssymb.sty": "texlive-amsfonts", + "amsthm.sty": "texlive-amscls", + "anyfontsize.sty": "texlive-anyfontsize", + "atbegshi.sty": "texlive-oberdiek", + "bm.sty": "texlive-tools", + "capt-of.sty": "texlive-capt-of", + "cmap.sty": "texlive-cmap", + "ctexhook.sty": "texlive-ctex", + "ecrm1000.tfm": "texlive-ec", + "eqparbox.sty": "texlive-eqparbox", + "eu1enc.def": "texlive-euenc", + "fancybox.sty": "texlive-fancybox", + "fancyvrb.sty": "texlive-fancyvrb", + "float.sty": "texlive-float", + "fncychap.sty": "texlive-fncychap", + "footnote.sty": "texlive-mdwtools", + "framed.sty": "texlive-framed", + "luatex85.sty": "texlive-luatex85", + "multirow.sty": "texlive-multirow", + "needspace.sty": "texlive-needspace", + "palatino.sty": "texlive-psnfss", + "parskip.sty": "texlive-parskip", + "polyglossia.sty": "texlive-polyglossia", + "tabulary.sty": "texlive-tabulary", + "threeparttable.sty": "texlive-threeparttable", + "titlesec.sty": "texlive-titlesec", + "ucs.sty": "texlive-ucs", + "upquote.sty": "texlive-upquote", + "wrapfig.sty": "texlive-wrapfig", + } + + def __init__(self, args): + self.pdf =3D args.pdf + self.virtualenv =3D args.virtualenv + self.version_check =3D args.version_check + + self.deps =3D DepManager(self.pdf) + + self.need_symlink =3D 0 + self.need_sphinx =3D 0 + self.need_pip =3D 0 + self.rec_sphinx_upgrade =3D 0 + self.verbose_warn_install =3D 1 + + self.system_release =3D "" + self.install =3D "" + self.virtenv_dir =3D "" + self.python_cmd =3D "" + self.activate_cmd =3D "" + + # Some distros may not have a Sphinx shipped package compatible wi= th + # our minimal requirements + self.package_supported =3D True + + # Recommend a new python version + self.recommend_python =3D None + + # Certain hints are meant to be shown only once + self.first_hint =3D True + + self.min_version =3D (0, 0, 0) + self.cur_version =3D (0, 0, 0) + self.latest_avail_ver =3D (0, 0, 0) + self.venv_ver =3D (0, 0, 0) + + prefix =3D os.environ.get("srctree", ".") + "/" + + self.conf =3D prefix + "Documentation/conf.py" + self.requirement_file =3D prefix + "Documentation/sphinx/requireme= nts.txt" + self.virtenv_prefix =3D ["sphinx_", "Sphinx_" ] + # # Methods to check if a feature exists # --=20 2.49.0