From nobody Sat Oct 4 22:37:58 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 CFB9E2F83D8; Tue, 12 Aug 2025 15:53:05 +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=1755013985; cv=none; b=iA22JMcIydt01giblUvd57SiFsKohaQw0AQqLWV0ITmriOQAtLPWuZqLwJHXfcQj23DGcQRt/tWD2OkqxcV+SObijkOdqTc8gKblugl7MvE/+zknxzU8lyEwBt8JBawbHgOscf++pvyxiL+IUww5Nn9e2qNy3d6mNILSBySU/Iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755013985; c=relaxed/simple; bh=wgqUPfvWSrBA5ivsAx4eRsEEzhKN45zQn51pt6lQAvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rk5ESwafhSO2WFNMqjGusuqxSWMhiD9caE2/5Gl5ziQoOs9fMVwEjFchTfGdm1TJki8jkOnquv1zZdi7ybZdJk18Ou+6g9OoqajEqPFTaMtqtsn13tTSB1m4S9ks/d4YbxkV6Seeo1R37MV9AACi2weG6LQZx/4QXxHeurf1yko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KVWlM2p5; 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="KVWlM2p5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6E72C19423; Tue, 12 Aug 2025 15:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755013985; bh=wgqUPfvWSrBA5ivsAx4eRsEEzhKN45zQn51pt6lQAvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KVWlM2p5sybpqHreC0thYYlbvhZcCKCNreb+B8RpCyenatfF1yn1fgvUGhGzoDQhD vC7fvfy6ufmIUkFn2vhItHxvqAaUL/QrYkgdqAlx/dlO9DShjpJlhlWd3yOsu/zRYX zsbZSDnbb0ZzEK7oA5hstceeM/X+Jc/qcYlupmF3it2AaHBDB9rvMvVgkTOzKLQU06 OPtLB4hP9I72pASpdSo8qS0D052pU+vD1gw0PL6hmVUDsVTfvkkRbE7qxnq28Xv4Hk aP/5teAMQIxC33zEb2qxnpUOJ5tbN7lQ9m85Fq48MkvnMVhJ7mzeRnVjxkxALM0TSD cfNFNpk5MvnKw== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1ulrJ8-00000006kXG-4AmJ; Tue, 12 Aug 2025 17:53:03 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 32/39] scripts: sphinx-pre-install: fix several codingstyle issues Date: Tue, 12 Aug 2025 17:52:49 +0200 Message-ID: <5139b18535e1436e4b1773706224a9ec3a386697.1754992972.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.50.1 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" Address most pylint issues. Signed-off-by: Mauro Carvalho Chehab --- scripts/sphinx-pre-install.py | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py index 1c96f6692e9a..1b11162da9fb 100755 --- a/scripts/sphinx-pre-install.py +++ b/scripts/sphinx-pre-install.py @@ -2,8 +2,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2017-2025 Mauro Carvalho Chehab # -# pylint: disable=3DC0103,C0114,C0115,C0116,C0301 -# pylint: disable=3DR0902,R0904,R0912,R0915,R1705,R1710,E1121 +# pylint: disable=3DC0103,C0114,C0115,C0116,C0301,C0302 +# pylint: disable=3DR0902,R0904,R0911,R0912,R0914,R0915,R1705,R1710,E1121 =20 # Note: this script requires at least Python 3.6 to run. # Don't add changes not compatible with it, it is meant to report @@ -115,7 +115,7 @@ class DepManager: if dtype[1]: return f"ERROR: {msg} mandatory deps missing" else: - out =3D f"Warning: {msg} optional deps missing" + return f"Warning: {msg} optional deps missing" =20 @staticmethod def is_optional(dtype): @@ -125,7 +125,7 @@ class DepManager: @staticmethod def is_pdf(dtype): """Ancillary routine to report if a dependency is for PDF generati= on""" - if (dtype[0] =3D=3D DepManager._PDF_TYPE): + if dtype[0] =3D=3D DepManager._PDF_TYPE: return True =20 return False @@ -191,8 +191,8 @@ class DepManager: self.missing_pkg[dtype].append(progs.get(prog, prog)) =20 install =3D [] - for dtype in self.missing_pkg.keys(): - install +=3D self.missing_pkg[dtype] + for dtype, pkgs in self.missing_pkg.items(): + install +=3D pkgs =20 return " ".join(sorted(set(install))) =20 @@ -267,8 +267,6 @@ class AncillaryMethods: "python3.[0-9][0-9]", ] =20 - new_python_cmd =3D None - # Seek for a python binary newer than MIN_PYTHON_VERSION for path in os.getenv("PATH", "").split(":"): for pattern in patterns: @@ -276,7 +274,7 @@ class AncillaryMethods: if os.path.isfile(cmd) and os.access(cmd, os.X_OK): version =3D SphinxDependencyChecker.get_python_ver= sion(cmd) if version >=3D MIN_PYTHON_VERSION: - return(cmd) + return cmd =20 @staticmethod def check_python(): @@ -306,8 +304,8 @@ class AncillaryMethods: =20 new_python_cmd =3D SphinxDependencyChecker.find_python() if not new_python_cmd: - print(f"ERROR: Python version {python_ver} is not spported any= more") - print(f" Can't find a new version. This script may fail") + print(f"ERROR: Python version {python_ver} is not spported any= more\n") + print(" Can't find a new version. This script may fail") return =20 # Restart script using the newer version @@ -362,6 +360,9 @@ class MissingCheckers(AncillaryMethods): self.version_check =3D args.version_check self.texlive =3D texlive =20 + self.min_version =3D (0, 0, 0) + self.cur_version =3D (0, 0, 0) + self.deps =3D DepManager(self.pdf) =20 self.need_symlink =3D 0 @@ -370,8 +371,10 @@ class MissingCheckers(AncillaryMethods): self.verbose_warn_install =3D 1 =20 self.virtenv_dir =3D "" - self.install =3D "" + self.python_cmd =3D "" + + self.virtenv_prefix =3D ["sphinx_", "Sphinx_" ] =20 def check_missing_file(self, files, package, dtype): """ @@ -542,10 +545,10 @@ class MissingCheckers(AncillaryMethods): self.min_version =3D parse_version(match.group(1)) break except IOError: - sys.exit(f"Can't open {self.conf}") + sys.exit(f"Can't open {conf}") =20 if not self.min_version: - sys.exit(f"Can't get needs_sphinx version from {self.conf}") + sys.exit(f"Can't get needs_sphinx version from {conf}") =20 self.virtenv_dir =3D self.virtenv_prefix[0] + "latest" =20 @@ -709,7 +712,6 @@ class SphinxDependencyChecker(MissingCheckers): self.rec_sphinx_upgrade =3D 0 =20 self.system_release =3D self.get_system_release() - self.python_cmd =3D "" self.activate_cmd =3D "" =20 # Some distros may not have a Sphinx shipped package compatible wi= th @@ -722,8 +724,6 @@ class SphinxDependencyChecker(MissingCheckers): # Certain hints are meant to be shown only once self.first_hint =3D True =20 - 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) =20 @@ -731,7 +731,6 @@ class SphinxDependencyChecker(MissingCheckers): =20 self.conf =3D prefix + "Documentation/conf.py" self.requirement_file =3D prefix + "Documentation/sphinx/requireme= nts.txt" - self.virtenv_prefix =3D ["sphinx_", "Sphinx_" ] =20 # # Distro-specific hints methods @@ -814,6 +813,7 @@ class SphinxDependencyChecker(MissingCheckers): =20 if not rel: print("Couldn't identify release number") + noto_sans_redhat =3D None self.pdf =3D False elif re.search("Fedora", self.system_release): # Fedora 38 and upper use this CJK font @@ -1111,7 +1111,7 @@ class SphinxDependencyChecker(MissingCheckers): for fname, portage in portages.items(): install =3D False =20 - while install =3D=3D False: + while install is False: if not files: # No files under package.usage. Install all install =3D True @@ -1335,7 +1335,7 @@ class SphinxDependencyChecker(MissingCheckers): old_optional =3D self.deps.optional =20 self.pdf =3D False - self.optional =3D 0 + self.deps.optional =3D 0 self.install =3D "" old_verbose =3D self.verbose_warn_install self.verbose_warn_install =3D 0 @@ -1346,8 +1346,8 @@ class SphinxDependencyChecker(MissingCheckers): =20 self.check_distros() =20 - self.need =3D old_need - self.optional =3D old_optional + self.deps.need =3D old_need + self.deps.optional =3D old_optional self.verbose_warn_install =3D old_verbose =20 def recommend_sphinx_version(self, virtualenv_cmd): @@ -1528,13 +1528,13 @@ class SphinxDependencyChecker(MissingCheckers): self.recommend_sphinx_version(virtualenv_cmd) print("") =20 - if not self.optional: + if not self.deps.optional: print("All optional dependencies are met.") =20 - if self.need =3D=3D 1: + if self.deps.need =3D=3D 1: sys.exit("Can't build as 1 mandatory dependency is missing") - elif self.need: - sys.exit(f"Can't build as {self.need} mandatory dependencies a= re missing") + elif self.deps.need: + sys.exit(f"Can't build as {self.deps.need} mandatory dependenc= ies are missing") =20 print("Needed package dependencies are met.") =20 --=20 2.50.1