From nobody Mon Dec 15 01:37:57 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 6BDF01DF749; Wed, 29 Jan 2025 16:10:00 +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=1738167000; cv=none; b=gMnj1QTeO/K/rXWP2oJEUDNlveggC7ODZWddipSzHz1hZx4IiL1kMRgq7M5M2vvFTeWyiSH7uEDHhITIVTI+qogBYUY2rlHkDWQgcjFgcPb72xaudATTVwYSWpgvT6XmV7NxERR4D5EVSbd8U/IEg9S6546DMWN5TOeJ4eOJbcM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738167000; c=relaxed/simple; bh=JR+LoyWBONX0t+AvCP4BfO6EcwJt+jCG4HP5PgBpHDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CTdy/ROZykJ3+bTgpe2r+hfcj7VgSutbVnksszMkMWGvQ8qXo/ZZbiFGhUkojYxhvCZYGRfGnPTkYzGWhLhltFlx8YkSQHFztxtkQwUpcqMcjLCxSGNGbxA5f0VaObiOaCPs+tVfKaLPDEzdxV8skfATUOmb10ckPr4qg/dUgS8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l9cZqgMj; 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="l9cZqgMj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F4E1C4AF09; Wed, 29 Jan 2025 16:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738166999; bh=JR+LoyWBONX0t+AvCP4BfO6EcwJt+jCG4HP5PgBpHDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l9cZqgMjUvaZpPlH8lTzAZvTP+z9CAciq4DnspSLcwW2QEUz0DekMpmPrIAXbtW5d O6HtYqtnuXlmLMOnpdGgTHqkRiVEkdXVS4vNmdkrOr7m+DUx2IY/Xpe5gjn1CvTjod hC3yj3LJSvVb/eQs84eXbPGDSxYXsm2lphv6CeLT+1R51wMKHQttfDr5ymPiVfR7VI IDF3jrs0pNGUQa0F42GJ65BoyIUpxASqDDZ7W3f/o0cjokqD3btp9ADYxEcTQKkOvD mcD/fF8GwLFCMwfab5sY0u47/8W7U1jc9Mf9RFGL33Kui8bSgP8aw2gwgGemF4jB+P EDZ8lcUzJvckg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tdAdZ-00000004PEW-1zNR; Wed, 29 Jan 2025 17:09:57 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , "Jonathan Corbet" Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , Randy Dunlap , Vegard Nossum , linux-kernel@vger.kernel.org Subject: [RFC 4/6] scripts/kernel-doc: drop Sphinx version check Date: Wed, 29 Jan 2025 17:09:35 +0100 Message-ID: <622e92a09daa6b4ecfa124c6c4232c1d970c3abe.1738166451.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.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" As the current minimal supported Sphinx version is 3.4.3, drop support for older versions. Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/cdomain.py | 3 - Documentation/sphinx/kerneldoc.py | 5 -- scripts/kernel-doc | 129 ++++-------------------------- 3 files changed, 16 insertions(+), 121 deletions(-) diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain= .py index 6596fd00663f..e8ea80d4324c 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py @@ -45,9 +45,6 @@ import re =20 __version__ =3D '1.1' =20 -# Get Sphinx version -major, minor, patch =3D sphinx.version_info[:3] - # Namespace to be prepended to the full name namespace =3D None =20 diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerne= ldoc.py index be5b8fbf373f..39ddae6ae7dd 100644 --- a/Documentation/sphinx/kerneldoc.py +++ b/Documentation/sphinx/kerneldoc.py @@ -62,11 +62,6 @@ class KernelDocDirective(Directive): env =3D self.state.document.settings.env cmd =3D [env.config.kerneldoc_bin, '-rst', '-enable-lineno'] =20 - # Pass the version string to kernel-doc, as it needs to use a diff= erent - # dialect, depending what the C domain supports for each specific - # Sphinx versions - cmd +=3D ['-sphinx-version', sphinx.__version__] - filename =3D env.config.kerneldoc_srctree + '/' + self.arguments[0] export_file_patterns =3D [] =20 diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 4ee843d3600e..84242c117ab9 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -26,7 +26,7 @@ kernel-doc - Print formatted kernel documentation to stdo= ut =20 kernel-doc [-h] [-v] [-Werror] [-Wall] [-Wreturn] [-Wshort-desc[ription]]= [-Wcontents-before-sections] [ -man | - -rst [-sphinx-version VERSION] [-enable-lineno] | + -rst [-enable-lineno] | -none ] [ @@ -130,7 +130,6 @@ if ($#ARGV =3D=3D -1) { } =20 my $kernelversion; -my ($sphinx_major, $sphinx_minor, $sphinx_patch); =20 my $dohighlight =3D ""; =20 @@ -347,23 +346,6 @@ while ($ARGV[0] =3D~ m/^--?(.*)/) { $enable_lineno =3D 1; } elsif ($cmd eq 'show-not-found') { $show_not_found =3D 1; # A no-op but don't fail - } elsif ($cmd eq "sphinx-version") { - my $ver_string =3D shift @ARGV; - if ($ver_string =3D~ m/^(\d+)(\.\d+)?(\.\d+)?/) { - $sphinx_major =3D $1; - if (defined($2)) { - $sphinx_minor =3D substr($2,1); - } else { - $sphinx_minor =3D 0; - } - if (defined($3)) { - $sphinx_patch =3D substr($3,1) - } else { - $sphinx_patch =3D 0; - } - } else { - die "Sphinx version should either major.minor or major.minor.p= atch format\n"; - } } else { # Unknown argument pod2usage( @@ -387,8 +369,6 @@ while ($ARGV[0] =3D~ m/^--?(.*)/) { =20 # continue execution near EOF; =20 -# The C domain dialect changed on Sphinx 3. So, we need to check the -# version in order to produce the right tags. sub findprog($) { foreach(split(/:/, $ENV{PATH})) { @@ -396,42 +376,6 @@ sub findprog($) } } =20 -sub get_sphinx_version() -{ - my $ver; - - my $cmd =3D "sphinx-build"; - if (!findprog($cmd)) { - my $cmd =3D "sphinx-build3"; - if (!findprog($cmd)) { - $sphinx_major =3D 1; - $sphinx_minor =3D 2; - $sphinx_patch =3D 0; - printf STDERR "Warning: Sphinx version not found. Using defaul= t (Sphinx version %d.%d.%d)\n", - $sphinx_major, $sphinx_minor, $sphinx_patch; - return; - } - } - - open IN, "$cmd --version 2>&1 |"; - while () { - if (m/^\s*sphinx-build\s+([\d]+)\.([\d\.]+)(\+\/[\da-f]+)?$/) { - $sphinx_major =3D $1; - $sphinx_minor =3D $2; - $sphinx_patch =3D $3; - last; - } - # Sphinx 1.2.x uses a different format - if (m/^\s*Sphinx.*\s+([\d]+)\.([\d\.]+)$/) { - $sphinx_major =3D $1; - $sphinx_minor =3D $2; - $sphinx_patch =3D $3; - last; - } - } - close IN; -} - # get kernel version from env sub get_kernel_version() { my $version =3D 'unknown kernel version'; @@ -859,9 +803,10 @@ sub output_function_rst(%) { $signature .=3D ")"; } =20 - if ($sphinx_major < 3) { + if ($args{'typedef'} || $args{'functiontype'} eq "") { + print ".. c:macro:: ". $args{'function'} . "\n\n"; + if ($args{'typedef'}) { - print ".. c:type:: ". $args{'function'} . "\n\n"; print_lineno($declaration_start_line); print " **Typedef**: "; $lineprefix =3D ""; @@ -869,25 +814,10 @@ sub output_function_rst(%) { print "\n\n**Syntax**\n\n"; print " ``$signature``\n\n"; } else { - print ".. c:function:: $signature\n\n"; + print "``$signature``\n\n"; } } else { - if ($args{'typedef'} || $args{'functiontype'} eq "") { - print ".. c:macro:: ". $args{'function'} . "\n\n"; - - if ($args{'typedef'}) { - print_lineno($declaration_start_line); - print " **Typedef**: "; - $lineprefix =3D ""; - output_highlight_rst($args{'purpose'}); - print "\n\n**Syntax**\n\n"; - print " ``$signature``\n\n"; - } else { - print "``$signature``\n\n"; - } - } else { - print ".. c:function:: $signature\n\n"; - } + print ".. c:function:: $signature\n\n"; } =20 if (!$args{'typedef'}) { @@ -955,13 +885,9 @@ sub output_enum_rst(%) { my $count; my $outer; =20 - if ($sphinx_major < 3) { - my $name =3D "enum " . $args{'enum'}; - print "\n\n.. c:type:: " . $name . "\n\n"; - } else { - my $name =3D $args{'enum'}; - print "\n\n.. c:enum:: " . $name . "\n\n"; - } + my $name =3D $args{'enum'}; + print "\n\n.. c:enum:: " . $name . "\n\n"; + print_lineno($declaration_start_line); $lineprefix =3D " "; output_highlight_rst($args{'purpose'}); @@ -992,11 +918,8 @@ sub output_typedef_rst(%) { my $oldprefix =3D $lineprefix; my $name; =20 - if ($sphinx_major < 3) { - $name =3D "typedef " . $args{'typedef'}; - } else { - $name =3D $args{'typedef'}; - } + $name =3D $args{'typedef'}; + print "\n\n.. c:type:: " . $name . "\n\n"; print_lineno($declaration_start_line); $lineprefix =3D " "; @@ -1012,17 +935,13 @@ sub output_struct_rst(%) { my ($parameter); my $oldprefix =3D $lineprefix; =20 - if ($sphinx_major < 3) { - my $name =3D $args{'type'} . " " . $args{'struct'}; - print "\n\n.. c:type:: " . $name . "\n\n"; + my $name =3D $args{'struct'}; + if ($args{'type'} eq 'union') { + print "\n\n.. c:union:: " . $name . "\n\n"; } else { - my $name =3D $args{'struct'}; - if ($args{'type'} eq 'union') { - print "\n\n.. c:union:: " . $name . "\n\n"; - } else { - print "\n\n.. c:struct:: " . $name . "\n\n"; - } + print "\n\n.. c:struct:: " . $name . "\n\n"; } + print_lineno($declaration_start_line); $lineprefix =3D " "; output_highlight_rst($args{'purpose'}); @@ -2387,11 +2306,6 @@ sub process_file($) { close IN_FILE; } =20 - -if ($output_mode eq "rst") { - get_sphinx_version() if (!$sphinx_major); -} - $kernelversion =3D get_kernel_version(); =20 # generate a sequence of code that will splice in highlighting information @@ -2471,17 +2385,6 @@ Do not output documentation, only warnings. =20 =3Dhead3 reStructuredText only =20 -=3Dover 8 - -=3Ditem -sphinx-version VERSION - -Use the ReST C domain dialect compatible with a specific Sphinx Version. - -If not specified, kernel-doc will auto-detect using the sphinx-build versi= on -found on PATH. - -=3Dback - =3Dhead2 Output selection (mutually exclusive): =20 =3Dover 8 --=20 2.48.1