From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Markus Heiser <markus.heiser@darmarit.de>,
Jani Nikula <jani.nikula@linux.intel.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 0/2] docs: Deal with some Sphinx deprecation warnings
Date: Wed, 22 May 2019 13:40:05 -0300 [thread overview]
Message-ID: <20190522134005.74d63bc3@coco.lan> (raw)
In-Reply-To: <20190522130408.5d8258de@coco.lan>
Em Wed, 22 May 2019 13:04:08 -0300
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> Em Wed, 22 May 2019 09:45:59 -0600
> Jonathan Corbet <corbet@lwn.net> escreveu:
>
> > On Wed, 22 May 2019 15:25:36 +0200
> > Markus Heiser <markus.heiser@darmarit.de> wrote:
> >
> > > Lets use 1.7 :
> > >
> > > - no need for Use_SSI wrapper
> > > - new log should work with 1.7 [1] --> no need for kernellog.py and
> > > additional imports, instead include on top of python modules ::
> > >
> > > from sphinx.util import logging
> > > logger = logging.getLogger('kerneldoc')
> >
> > I think we're going to have to drag things forward at some point in the
> > not-too-distant future, but I think I'd rather not do that quite yet. The
> > cost of supporting older sphinx for a few releases while we warn people is
> > not all that high. So I think we should:
> >
> > - Put in (a future version of) my hacks for now, plus whatever else might
> > be needed to make 2.0 work right.
> >
> > - Fix the fallout with regard to out-of-toctree .rst files so that we can
> > actually build again with current sphinx.
> >
> > - Update Documentation/sphinx/requirements.txt to ask for something a wee
> > bit more recent than 1.4.9.
>
> You should remember to also update conf.py (with currently points to 1.3):
>
> # If your documentation needs a minimal Sphinx version, state it here.
> needs_sphinx = '1.3'
>
> Also, if you touch there, you should also touch:
>
> ./scripts/sphinx-pre-install
>
> The change there won't be as trivial as just changing this line:
>
> $virtenv_dir = "sphinx_1.4";
>
> as the script should now run sphinx-build --version, in order to check
> if the version is lower than the new minimal version. It probably makes
> sense to make it grep the version from needs_sphinx at conf.py.
>
> > - Add a warning when building with an older version that (say) 1.7 will
> > be required as of (say) 5.5.
>
> It probably makes sense to add such check at the pre-install script,
> and add a:
>
> SPHINXOPTS="-jauto"
>
> somewhere if version is 1.7 or upper.
>
I'm meaning something like the enclosed patch.
(PS.: I'm still working at the patch)
Thanks,
Mauro
[RFC PATCH] scripts/sphinx-pre-install: make it handle Sphinx versions
As we want to switch to a newer Sphinx version in the future,
add some version detected logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index f6a5c0bae31e..8835aede4c61 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -13,7 +13,7 @@ use strict;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-my $virtenv_dir = "sphinx_1.4";
+my $conf = "Documentation/conf.py";
my $requirement_file = "Documentation/sphinx/requirements.txt";
#
@@ -27,6 +27,10 @@ my $optional = 0;
my $need_symlink = 0;
my $need_sphinx = 0;
my $install = "";
+my $min_version;
+my $rec_version;
+my $cur_version;
+my $virtenv_dir = "sphinx_";
#
# Command line arguments
@@ -76,6 +80,52 @@ my %texlive = (
# Subroutines that checks if a feature exists
#
+sub handle_sphinx_version()
+{
+ open IN, $conf;
+ while (<IN>) {
+ if (m/^\s*needs_sphinx\s*=\s*[\'\"]([\d\.]+)[\'\"]/) {
+ $min_version=$1;
+ last;
+ }
+ }
+ close IN;
+
+ die "Can't get needs_sphinx version from $conf" if (!$min_version);
+
+ open IN, $requirement_file;
+ while (<IN>) {
+ if (m/^\s*Sphinx\s*==\s*([\d\.]+)$/) {
+ $rec_version=$1;
+ last;
+ }
+ }
+ close IN;
+
+ open IN, "sphinx-build --version 2>&1 |";
+ while (<IN>) {
+ if (m/^\s*sphinx-build\s+([\d\.]+)$/) {
+ $cur_version=$1;
+ last;
+ }
+ }
+ close IN;
+
+ $virtenv_dir .= $rec_version;
+
+ # Sphinx is not installed
+ return if (!$cur_version);
+
+ if ($cur_version lt $min_version) {
+ print "Sphinx version older than $min_version! We recommend at least $rec_version";
+ exit -1;
+ }
+
+ if ($cur_version lt $rec_version) {
+ print "Warning: we recommend at least Sphinx version $rec_version";
+ }
+}
+
sub check_missing(%)
{
my %map = %{$_[0]};
@@ -587,6 +637,8 @@ while (@ARGV) {
}
}
+handle_sphinx_version();
+
#
# Determine the system type. There's no standard unique way that would
# work with all distros with a minimal package install. So, several
next prev parent reply other threads:[~2019-05-22 16:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 21:17 [PATCH RFC 0/2] docs: Deal with some Sphinx deprecation warnings Jonathan Corbet
2019-05-21 21:17 ` [PATCH 1/2] doc: Cope with Sphinx logging deprecations Jonathan Corbet
2019-05-21 21:17 ` [PATCH 2/2] doc: Cope with the deprecation of AutoReporter Jonathan Corbet
2019-05-22 7:38 ` Jani Nikula
2019-05-22 7:36 ` [PATCH RFC 0/2] docs: Deal with some Sphinx deprecation warnings Jani Nikula
2019-05-22 10:19 ` Mauro Carvalho Chehab
2019-05-22 13:25 ` Markus Heiser
2019-05-22 15:45 ` Jonathan Corbet
2019-05-22 16:04 ` Mauro Carvalho Chehab
2019-05-22 16:40 ` Mauro Carvalho Chehab [this message]
2019-05-22 9:43 ` Oleksandr Natalenko
2019-05-22 9:49 ` Oleksandr Natalenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190522134005.74d63bc3@coco.lan \
--to=mchehab@kernel.org \
--cc=corbet@lwn.net \
--cc=jani.nikula@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.heiser@darmarit.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.