]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scripts: sphinx-pre-install: change the output order
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 21 Apr 2020 16:27:58 +0000 (18:27 +0200)
committerJonathan Corbet <corbet@lwn.net>
Tue, 28 Apr 2020 18:52:52 +0000 (12:52 -0600)
When the script detects the need for an upgrade, it will
print either a warning or a note.

Let's change a little bit the order where messages will be
displayed, in order to make easier for the user to identify
the more important messages.

It should now be like this:

Detected OS: Fedora release 31 (Thirty One).
Sphinx version: 1.7.9

Note: It is recommended at least Sphinx version 2.4.4 if you need PDF support.
To upgrade Sphinx, use:

/usr/bin/python3 -m venv sphinx_2.4.4
. sphinx_2.4.4/bin/activate
pip install -r ./Documentation/sphinx/requirements.txt

If you want to exit the virtualenv, you can use:
deactivate

All optional dependencies are met.
Needed package dependencies are met.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20200421182758.04e0a53e@coco.lan
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/sphinx-pre-install

index 987aebf7e3a0d858557a4688c01da151e3c1425f..c680c3efb176ef7764f1538c6036ce436c8d8125 100755 (executable)
@@ -320,15 +320,10 @@ sub check_sphinx()
        }
 
        if ($cur_version lt $rec_version) {
-               printf "Sphinx version %s\n", $cur_version;
-               print "Warning: It is recommended at least Sphinx version $rec_version.\n";
-               print "         If you want pdf, you need at least $min_pdf_version.\n";
                $rec_sphinx_upgrade = 1;
                return;
        }
        if ($cur_version lt $min_pdf_version) {
-               printf "Sphinx version %s\n", $cur_version;
-               print "Note: It is recommended at least Sphinx version $min_pdf_version if you need PDF support.\n";
                $rec_sphinx_upgrade = 1;
                return;
        }
@@ -716,10 +711,11 @@ sub check_needs()
        check_sphinx();
 
        if ($system_release) {
-               print "Detected OS: $system_release.\n\n";
+               print "Detected OS: $system_release.\n";
        } else {
-               print "Unknown OS\n\n";
+               print "Unknown OS\n";
        }
+       printf "Sphinx version: %s\n\n", $cur_version if ($cur_version);
 
        # Check python command line, trying first python3
        $python_cmd = findprog("python3");
@@ -799,6 +795,13 @@ sub check_needs()
                my $min_activate = "$ENV{'PWD'}/${virtenv_prefix}${min_version}/bin/activate";
                my @activates = glob "$ENV{'PWD'}/${virtenv_prefix}*/bin/activate";
 
+               if ($cur_version lt $rec_version) {
+                       print "Warning: It is recommended at least Sphinx version $rec_version.\n";
+                       print "         If you want pdf, you need at least $min_pdf_version.\n";
+               }
+               if ($cur_version lt $min_pdf_version) {
+                       print "Note: It is recommended at least Sphinx version $min_pdf_version if you need PDF support.\n";
+               }
                @activates = sort {$b cmp $a} @activates;
                my ($activate, $ver);
                foreach my $f (@activates) {