From nobody Tue Oct 7 14:57:05 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 77C402E54A6; Wed, 9 Jul 2025 13:52:21 +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=1752069141; cv=none; b=nqmgG8ZCyHZSvvn0SsBKtIDBN1wb3mVaHIFp/yq785puxO2PJ+P56qi9lFyFLExt1yfoPmTsccsxTOure/oH6cWtuY53a12evD3ZRSDaoU7fzUHTvapbS9Jk0ULVXyq+UR8U3OmOnJZOi/g+wtMa/WRM2zUeHeeV/+hkuDPFigE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752069141; c=relaxed/simple; bh=qA/uqUmIAOWlGTOXnYG6XWQvPfob7ubvzaDqauGY4qM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oz09WnrLxPpVPe4l8M7jrozHLvI04BSaUrZGnF7VLHFepbHjGdAM1fAHMVHnYscBpkyCQx+IDkEGya8cGMS9FdEY4viFSR71PdTp5Ivbi6IqeqhFliPpAt9X5W+mE5OYAZeC/oDL7fWFXSfaWEvogGTdJwOLBbaGUpwACj5gc64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TMzPMACG; 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="TMzPMACG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A96BC2BCB3; 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=qA/uqUmIAOWlGTOXnYG6XWQvPfob7ubvzaDqauGY4qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMzPMACGJeU/xk69fHdxhYxYoXp9GeMmhcaCH/7PIQNFr2ugVfvs7MOSN3qDp87pp a3B+mIYTCAEcc5PRWfFVHYm8GkQZL0yJTG4pa4zS5sylJVBLU8HWKfmYJD1Nd1sUGe IgiVlMSsWlFhGaLCxmLEb/xHv7mVP+fib0jgRpU33xxUJNBsWwB/rRRtugzcaPXaxn Mxw1WYMP+kb1Yv9k4LN+D5iXo3k6WRc36pyWmu9qKIqHZblCkAflmMRjj1ZsGEKsI5 kjVTm8NeL1hwtGCuibFZHs4nWvVbJWuPaBuVJ93hAeuK3kHMruU4j84jcvzNCSSuhl 67tgcgCMVkQGw== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uZVDd-00000000EDg-3Kez; 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 32/39] scripts: sphinx-pre-install: fix several codingstyle issues Date: Wed, 9 Jul 2025 15:52:04 +0200 Message-ID: <5a3daf7244332e48a1d49dc70d73fb12a765493d.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" 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.49.0