Skip to content

Commit b31274d

Browse files
bulwahnJonathan Corbet
authored andcommitted
docs: drop the version constraints for sphinx and dependencies
As discussed (see Links), there is some inertia to move to the recent Sphinx versions for the doc build environment. As first step, drop the version constraints and the related comments. As sphinx depends on jinja2, jinja2 is pulled in automatically. So drop that. Then, the sphinx-pre-install script will fail though with: Can't get default sphinx version from ./Documentation/sphinx/requirements.txt at ./scripts/sphinx-pre-install line 305. The script simply expects to parse a version constraint with Sphinx in the requirements.txt. That version is used in the script for suggesting the virtualenv directory name. To suggest a virtualenv directory name, when there is no version given in the requirements.txt, one could try to guess the version that would be downloaded with 'pip install -r Documentation/sphinx/requirements.txt'. However, there seems no simple way to get that version without actually setting up the venv and running pip. So, instead, name the directory with the fixed name 'sphinx_latest'. Finally update the Sphinx build documentation to reflect this directory name change. Link: https://lore.kernel.org/linux-doc/[email protected]/ Link: https://lore.kernel.org/linux-doc/[email protected]/ Reviewed-by: Akira Yokosawa <[email protected]> Tested-by: Vegard Nossum <[email protected]> Signed-off-by: Lukas Bulwahn <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Message-ID: <[email protected]>
1 parent 0df46e0 commit b31274d

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

Documentation/doc-guide/sphinx.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ or ``virtualenv``, depending on how your distribution packaged Python 3.
4848
on the Sphinx version, it should be installed separately,
4949
with ``pip install sphinx_rtd_theme``.
5050

51-
In summary, if you want to install Sphinx version 2.4.4, you should do::
51+
In summary, if you want to install the latest version of Sphinx, you
52+
should do::
5253

53-
$ virtualenv sphinx_2.4.4
54-
$ . sphinx_2.4.4/bin/activate
55-
(sphinx_2.4.4) $ pip install -r Documentation/sphinx/requirements.txt
54+
$ virtualenv sphinx_latest
55+
$ . sphinx_latest/bin/activate
56+
(sphinx_latest) $ pip install -r Documentation/sphinx/requirements.txt
5657

57-
After running ``. sphinx_2.4.4/bin/activate``, the prompt will change,
58+
After running ``. sphinx_latest/bin/activate``, the prompt will change,
5859
in order to indicate that you're using the new environment. If you
5960
open a new shell, you need to rerun this command to enter again at
6061
the virtual environment before building the documentation.

Documentation/sphinx/requirements.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# jinja2>=3.1 is not compatible with Sphinx<4.0
2-
jinja2<3.1
3-
# alabaster>=0.7.14 is not compatible with Sphinx<=3.3
4-
alabaster<0.7.14
5-
Sphinx==2.4.4
1+
alabaster
2+
Sphinx
63
pyyaml

scripts/sphinx-pre-install

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ sub get_sphinx_version($)
280280

281281
sub check_sphinx()
282282
{
283-
my $default_version;
284-
285283
open IN, $conf or die "Can't open $conf";
286284
while (<IN>) {
287285
if (m/^\s*needs_sphinx\s*=\s*[\'\"]([\d\.]+)[\'\"]/) {
@@ -293,18 +291,7 @@ sub check_sphinx()
293291

294292
die "Can't get needs_sphinx version from $conf" if (!$min_version);
295293

296-
open IN, $requirement_file or die "Can't open $requirement_file";
297-
while (<IN>) {
298-
if (m/^\s*Sphinx\s*==\s*([\d\.]+)$/) {
299-
$default_version=$1;
300-
last;
301-
}
302-
}
303-
close IN;
304-
305-
die "Can't get default sphinx version from $requirement_file" if (!$default_version);
306-
307-
$virtenv_dir = $virtenv_prefix . $default_version;
294+
$virtenv_dir = $virtenv_prefix . "latest";
308295

309296
my $sphinx = get_sphinx_fname();
310297
if ($sphinx eq "") {
@@ -318,8 +305,8 @@ sub check_sphinx()
318305
die "$sphinx didn't return its version" if (!$cur_version);
319306

320307
if ($cur_version lt $min_version) {
321-
printf "ERROR: Sphinx version is %s. It should be >= %s (recommended >= %s)\n",
322-
$cur_version, $min_version, $default_version;
308+
printf "ERROR: Sphinx version is %s. It should be >= %s\n",
309+
$cur_version, $min_version;
323310
$need_sphinx = 1;
324311
return;
325312
}

0 commit comments

Comments
 (0)