Skip to content

Commit a23d9de

Browse files
mchehabopsiff
authored andcommitted
scripts: kdoc_parser.py: warn about Python version only once
[ Upstream commit ade9b95 ] When running kernel-doc over multiple documents, it emits one error message per file with is not what we want: $ python3.6 scripts/kernel-doc.py . --none ... Warning: ./include/trace/events/swiotlb.h:0 Python 3.7 or later is required for correct results Warning: ./include/trace/events/iommu.h:0 Python 3.7 or later is required for correct results Warning: ./include/trace/events/sock.h:0 Python 3.7 or later is required for correct results ... Change the logic to warn it only once at the library: $ python3.6 scripts/kernel-doc.py . --none Warning: Python 3.7 or later is required for correct results Warning: ./include/cxl/features.h:0 Python 3.7 or later is required for correct results When running from command line, it warns twice, but that sounds ok. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Message-ID: <68e54cf8b1201d1f683aad9bc710a99421910356.1758196090.git.mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit ab665eb9997198408b915724df6954156260bfd3) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent e9df6a2 commit a23d9de

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ def dump_section(self, start_new=True):
350350
self.section = SECTION_DEFAULT
351351
self._contents = []
352352

353+
python_warning = False
353354

354355
class KernelDoc:
355356
"""
@@ -383,9 +384,13 @@ def __init__(self, config, fname):
383384
# We need Python 3.7 for its "dicts remember the insertion
384385
# order" guarantee
385386
#
386-
if sys.version_info.major == 3 and sys.version_info.minor < 7:
387+
global python_warning
388+
if (not python_warning and
389+
sys.version_info.major == 3 and sys.version_info.minor < 7):
390+
387391
self.emit_msg(0,
388392
'Python 3.7 or later is required for correct results')
393+
python_warning = True
389394

390395
def emit_msg(self, ln, msg, warning=True):
391396
"""Emit a message"""

0 commit comments

Comments
 (0)