Re: [PATCH] docs: Remove "could not extract kernel version" warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Am 12.12.2017 um 08:40 schrieb Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>:
> 
> On Mon, 11 Dec 2017, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>> On 12/11/2017 02:24 PM, Jonathan Corbet wrote:
>>> This warning will happen for every normal kernel docs build and doesn't
>>> carry any useful information.  Should anybody actually depend on this
>>> "version" variable (which isn't clear to me), the "unknown version" value
>>> will be clue enough.
>> 
>> Yay.  I looked at that last week and got nowhere with it.
> 
> The whole try block was for when sphinx-build is run directly, e.g. when
> run by Read the Docs or manually on the command line. But looking at all
> the Makefile sauce we've accumulated, we're probably way, *way* beyond
> the point where building the docs is in any way feasible by running
> sphinx-build directly.

Ah, yes I remember. It was about RTD. Nowadays we handle $(BUILDDIR) and
conf.py files for "sub-projects" with we can no longer maintain native
sphinx builds.


> The Makefile passes version and release on the sphinx-build command line
> in our normal build, so we could just remove the try block
> altogether. It's more like a fallback hack anyway.
> 
> The version shows up in the built documentation, depending on the theme.
> 
> Nothing wrong with this patch, but could go further.

Right, this is what I have tried:

modified   Documentation/conf.py
@@ -65,31 +65,9 @@ author = 'The kernel development community'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-# In a normal build, version and release are are set to KERNELVERSION and
-# KERNELRELEASE, respectively, from the Makefile via Sphinx command line
-# arguments.
-#
-# The following code tries to extract the information by reading the Makefile,
-# when Sphinx is run directly (e.g. by Read the Docs).
-try:
-    makefile_version = None
-    makefile_patchlevel = None
-    for line in open('../Makefile'):
-        key, val = [x.strip() for x in line.split('=', 2)]
-        if key == 'VERSION':
-            makefile_version = val
-        elif key == 'PATCHLEVEL':
-            makefile_patchlevel = val
-        if makefile_version and makefile_patchlevel:
-            break
-except:
-    pass
-finally:
-    if makefile_version and makefile_patchlevel:
-        version = release = makefile_version + '.' + makefile_patchlevel
-    else:
-        sys.stderr.write('Warning: Could not extract kernel version\n')
-        version = release = "unknown version"
+# In a normal build, version and release are set to KERNELVERSION and
+# KERNELRELEASE from the Makefile via Sphinx command line arguments.
+version = release = "unknown version"

-- Markus --


> 
> BR,
> Jani.
> 
> 
>> 
>>> Signed-off-by: Jonathan Corbet <corbet@xxxxxxx>
>>> ---
>>> Documentation/conf.py | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> diff --git a/Documentation/conf.py b/Documentation/conf.py
>>> index 63857d33778c..62ac5a9f3a9f 100644
>>> --- a/Documentation/conf.py
>>> +++ b/Documentation/conf.py
>>> @@ -88,7 +88,6 @@ finally:
>>>    if makefile_version and makefile_patchlevel:
>>>        version = release = makefile_version + '.' + makefile_patchlevel
>>>    else:
>>> -        sys.stderr.write('Warning: Could not extract kernel version\n')
>>>        version = release = "unknown version"
>>> 
>>> # The language for content autogenerated by Sphinx. Refer to documentation
>>> 
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
> --
> To unsubscribe from this list: send the line "unsubscribe linux-doc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux