[PATCH] docs/sphinx: Refresh config for newer Sphinx

Andrew Cooper posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20241122165102.3240758-1-andrew.cooper3@citrix.com
docs/conf.py | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
[PATCH] docs/sphinx: Refresh config for newer Sphinx
Posted by Andrew Cooper 2 weeks ago
Sphinx 5.0 and newer objects to language = None.  Switch to 'en'.

Also update the copyright year.  Use %Y to avoid this problem in the future,
and provide compatibility for versions of Sphinx prior to 8.1 which don't
support the syntax.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>

This is in prepartion to get a Gitlab CI docs job, and to activate Sphinx's
-Werror equivelent.
---
 docs/conf.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 50e41501db8f..5d2e97944900 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -3,9 +3,8 @@
 #
 # Configuration file for the Sphinx documentation builder.
 #
-# This file does only contain a selection of the most common options. For a
-# full list see the documentation:
-# http://www.sphinx-doc.org/en/master/config
+# For the full list of built-in configuration values, see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
 
 # -- Path setup --------------------------------------------------------------
 
@@ -19,11 +18,18 @@
 
 
 # -- Project information -----------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
+
+import sphinx
 
 project = u'Xen'
-copyright = u'2019, The Xen development community'
+copyright = u'2019-%Y, The Xen development community'
 author = u'The Xen development community'
 
+if sphinx.version_info < (8, 1):
+    from datetime import datetime
+    copyright = datetime.today().strftime(copyright)
+
 # Pull the Xen version straight out of the Makefile
 try:
     xen_ver = xen_subver = xen_extra = None
@@ -45,6 +51,7 @@ finally:
         version = release = u"unknown version"
 
 # -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
 
 # If your documentation needs a minimal Sphinx version, state it here.
 #
@@ -69,10 +76,7 @@ master_doc = 'index'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = None
+language = 'en'
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
@@ -86,6 +90,7 @@ primary_domain = 'c'
 highlight_language = 'none'
 
 # -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.

base-commit: c0bf8816c9e2a4701c925d8b23abfda5990a0087
prerequisite-patch-id: b4ef4fc3ee5669c078aa0b9c7501ac7ef673966c
-- 
2.39.5
Re: [PATCH] docs/sphinx: Refresh config for newer Sphinx
Posted by Stefano Stabellini 2 weeks ago
On Fri, 22 Nov 2024, Andrew Cooper wrote:
> Sphinx 5.0 and newer objects to language = None.  Switch to 'en'.
> 
> Also update the copyright year.  Use %Y to avoid this problem in the future,
> and provide compatibility for versions of Sphinx prior to 8.1 which don't
> support the syntax.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> 
> This is in prepartion to get a Gitlab CI docs job, and to activate Sphinx's
> -Werror equivelent.
> ---
>  docs/conf.py | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/conf.py b/docs/conf.py
> index 50e41501db8f..5d2e97944900 100644
> --- a/docs/conf.py
> +++ b/docs/conf.py
> @@ -3,9 +3,8 @@
>  #
>  # Configuration file for the Sphinx documentation builder.
>  #
> -# This file does only contain a selection of the most common options. For a
> -# full list see the documentation:
> -# http://www.sphinx-doc.org/en/master/config
> +# For the full list of built-in configuration values, see the documentation:
> +# https://www.sphinx-doc.org/en/master/usage/configuration.html
>  
>  # -- Path setup --------------------------------------------------------------
>  
> @@ -19,11 +18,18 @@
>  
>  
>  # -- Project information -----------------------------------------------------
> +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
> +
> +import sphinx
>  
>  project = u'Xen'
> -copyright = u'2019, The Xen development community'
> +copyright = u'2019-%Y, The Xen development community'
>  author = u'The Xen development community'
>  
> +if sphinx.version_info < (8, 1):
> +    from datetime import datetime
> +    copyright = datetime.today().strftime(copyright)
> +
>  # Pull the Xen version straight out of the Makefile
>  try:
>      xen_ver = xen_subver = xen_extra = None
> @@ -45,6 +51,7 @@ finally:
>          version = release = u"unknown version"
>  
>  # -- General configuration ---------------------------------------------------
> +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
>  
>  # If your documentation needs a minimal Sphinx version, state it here.
>  #
> @@ -69,10 +76,7 @@ master_doc = 'index'
>  
>  # The language for content autogenerated by Sphinx. Refer to documentation
>  # for a list of supported languages.
> -#
> -# This is also used if you do content translation via gettext catalogs.
> -# Usually you set "language" from the command line for these cases.
> -language = None
> +language = 'en'
>  
>  # List of patterns, relative to source directory, that match files and
>  # directories to ignore when looking for source files.
> @@ -86,6 +90,7 @@ primary_domain = 'c'
>  highlight_language = 'none'
>  
>  # -- Options for HTML output -------------------------------------------------
> +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
>  
>  # The theme to use for HTML and HTML Help pages.  See the documentation for
>  # a list of builtin themes.
> 
> base-commit: c0bf8816c9e2a4701c925d8b23abfda5990a0087
> prerequisite-patch-id: b4ef4fc3ee5669c078aa0b9c7501ac7ef673966c
> -- 
> 2.39.5
>