[polly] e80c529 - [docs] Remove hard-coded version numbers from sphinx configs

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 23:14:27 PST 2022


Author: Tom Stellard
Date: 2022-02-01T23:14:12-08:00
New Revision: e80c52986e1bb3afa6a92c58b1cb897877923a66

URL: https://github.com/llvm/llvm-project/commit/e80c52986e1bb3afa6a92c58b1cb897877923a66
DIFF: https://github.com/llvm/llvm-project/commit/e80c52986e1bb3afa6a92c58b1cb897877923a66.diff

LOG: [docs] Remove hard-coded version numbers from sphinx configs

This updates all the non-runtime project release notes to use the
version number from CMake instead of the hard-coded version numbers
in conf.py.

It also hides warnings about pre-releases when the git suffix
is dropped from the LLVM version in CMake.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112181

Added: 
    

Modified: 
    clang-tools-extra/docs/ReleaseNotes.rst
    clang-tools-extra/docs/conf.py
    clang/docs/ReleaseNotes.rst
    clang/docs/conf.py
    lld/docs/ReleaseNotes.rst
    lld/docs/conf.py
    llvm/cmake/modules/AddSphinxTarget.cmake
    llvm/docs/ReleaseNotes.rst
    llvm/docs/conf.py
    polly/docs/ReleaseNotes.rst
    polly/docs/conf.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 7f4f814221f73..59aff131f6c22 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -1,5 +1,5 @@
 ====================================================
-Extra Clang Tools 14.0.0 (In-Progress) Release Notes
+Extra Clang Tools |release| |ReleaseNotesTitle|
 ====================================================
 
 .. contents::
@@ -8,17 +8,18 @@ Extra Clang Tools 14.0.0 (In-Progress) Release Notes
 
 Written by the `LLVM Team <https://llvm.org/>`_
 
-.. warning::
+.. only:: PreRelease
 
-   These are in-progress notes for the upcoming Extra Clang Tools 14 release.
-   Release notes for previous releases can be found on
-   `the Download Page <https://releases.llvm.org/download.html>`_.
+  .. warning::
+     These are in-progress notes for the upcoming Extra Clang Tools |version| release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
 
 Introduction
 ============
 
 This document contains the release notes for the Extra Clang Tools, part of the
-Clang release 14.0.0. Here we describe the status of the Extra Clang Tools in
+Clang release |release|. Here we describe the status of the Extra Clang Tools in
 some detail, including major improvements from the previous release and new
 feature work. All LLVM releases may be downloaded from the `LLVM releases web
 site <https://llvm.org/releases/>`_.
@@ -32,8 +33,8 @@ main Clang web page, this document applies to the *next* release, not
 the current one. To see the release notes for a specific release, please
 see the `releases page <https://llvm.org/releases/>`_.
 
-What's New in Extra Clang Tools 14.0.0?
-=======================================
+What's New in Extra Clang Tools |release|?
+==========================================
 
 Some of the major new features and improvements to Extra Clang Tools are listed
 here. Generic improvements to Extra Clang Tools as a whole or to its underlying

diff  --git a/clang-tools-extra/docs/conf.py b/clang-tools-extra/docs/conf.py
index 24dbcb1446776..bf8dd05cb6f8d 100644
--- a/clang-tools-extra/docs/conf.py
+++ b/clang-tools-extra/docs/conf.py
@@ -44,15 +44,6 @@
 project = u'Extra Clang Tools'
 copyright = u'2007-%d, The Clang Team' % date.today().year
 
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short version.
-version = '14'
-# The full version, including alpha/beta/rc tags.
-release = '14'
-
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #language = None
@@ -87,6 +78,11 @@
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
 
+in_progress_title = "(In-Progress) " if tags.has("PreRelease") else ""
+
+rst_epilog = f"""
+.. |ReleaseNotesTitle| replace:: {in_progress_title} Release Notes
+"""
 
 # -- Options for HTML output ---------------------------------------------------
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 0c9968597b737..5cc53e9ec27b2 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1,6 +1,6 @@
-========================================
-Clang 14.0.0 (In-Progress) Release Notes
-========================================
+===========================================
+Clang |release| |ReleaseNotesTitle|
+===========================================
 
 .. contents::
    :local:
@@ -8,17 +8,18 @@ Clang 14.0.0 (In-Progress) Release Notes
 
 Written by the `LLVM Team <https://llvm.org/>`_
 
-.. warning::
+.. only:: PreRelease
 
-   These are in-progress notes for the upcoming Clang 14 release.
-   Release notes for previous releases can be found on
-   `the Download Page <https://releases.llvm.org/download.html>`_.
+  .. warning::
+     These are in-progress notes for the upcoming Clang |version| release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
 
 Introduction
 ============
 
 This document contains the release notes for the Clang C/C++/Objective-C
-frontend, part of the LLVM Compiler Infrastructure, release 14.0.0. Here we
+frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
 describe the status of Clang in some detail, including major
 improvements from the previous release and new feature work. For the
 general LLVM release notes, see `the LLVM
@@ -35,8 +36,8 @@ main Clang web page, this document applies to the *next* release, not
 the current one. To see the release notes for a specific release, please
 see the `releases page <https://llvm.org/releases/>`_.
 
-What's New in Clang 14.0.0?
-===========================
+What's New in Clang |release|?
+==============================
 
 Some of the major new features and improvements to Clang are listed
 here. Generic improvements to Clang as a whole or to its underlying

diff  --git a/clang/docs/conf.py b/clang/docs/conf.py
index 690c8430a321f..b8a42018191ab 100644
--- a/clang/docs/conf.py
+++ b/clang/docs/conf.py
@@ -62,15 +62,6 @@
 project = u'Clang'
 copyright = u'2007-%d, The Clang Team' % date.today().year
 
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short version.
-version = '13'
-# The full version, including alpha/beta/rc tags.
-release = '13'
-
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #language = None
@@ -105,6 +96,11 @@
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
 
+in_progress_title = "(In-Progress) " if tags.has("PreRelease") else ""
+
+rst_epilog = f"""
+.. |ReleaseNotesTitle| replace:: {in_progress_title} Release Notes
+"""
 
 # -- Options for HTML output ---------------------------------------------------
 

diff  --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index f3358c872e2ff..82683801fad94 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -1,19 +1,21 @@
-========================
-lld 14.0.0 Release Notes
-========================
+===========================
+lld |release| Release Notes
+===========================
 
 .. contents::
     :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 14.0.0 release.
-   Release notes for previous releases can be found on
-   `the Download Page <https://releases.llvm.org/download.html>`_.
+.. only:: PreRelease
+
+  .. warning::
+     These are in-progress notes for the upcoming LLVM |release| release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
 
 Introduction
 ============
 
-This document contains the release notes for the lld linker, release 14.0.0.
+This document contains the release notes for the lld linker, release |release|.
 Here we describe the status of lld, including major improvements
 from the previous release. All lld releases may be downloaded
 from the `LLVM releases web site <https://llvm.org/releases/>`_.

diff  --git a/lld/docs/conf.py b/lld/docs/conf.py
index 8d0fec72caf8e..95befddf80ea3 100644
--- a/lld/docs/conf.py
+++ b/lld/docs/conf.py
@@ -43,15 +43,6 @@
 project = u'lld'
 copyright = u'2011-%d, LLVM Project' % date.today().year
 
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short version.
-version = '14'
-# The full version, including alpha/beta/rc tags.
-release = '14'
-
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #language = None

diff  --git a/llvm/cmake/modules/AddSphinxTarget.cmake b/llvm/cmake/modules/AddSphinxTarget.cmake
index 5bd368b6d5536..bbc889c6b0850 100644
--- a/llvm/cmake/modules/AddSphinxTarget.cmake
+++ b/llvm/cmake/modules/AddSphinxTarget.cmake
@@ -39,6 +39,10 @@ function (add_sphinx_target builder project)
     set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
   endif()
 
+  if ("${LLVM_VERSION_SUFFIX}" STREQUAL "git")
+    set(PreReleaseTag "-tPreRelease")
+  endif()
+
   add_custom_target(${SPHINX_TARGET_NAME}
                     COMMAND ${CMAKE_COMMAND} -E env ${ARG_ENV_VARS}
                             ${SPHINX_EXECUTABLE}
@@ -46,6 +50,9 @@ function (add_sphinx_target builder project)
                             -d "${SPHINX_DOC_TREE_DIR}"
                             -q # Quiet: no output other than errors and warnings.
                             -t builder-${builder} # tag for builder
+                            -D version=${LLVM_VERSION_MAJOR}
+                            -D release=${PACKAGE_VERSION}
+                            ${PreReleaseTag}
                             ${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings as errors if requested
                             "${ARG_SOURCE_DIR}" # Source
                             "${SPHINX_BUILD_DIR}" # Output

diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 2c6c15718917e..3745128fd948d 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -1,21 +1,23 @@
-=========================
-LLVM 14.0.0 Release Notes
-=========================
+============================
+LLVM |release| Release Notes
+============================
 
 .. contents::
     :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 14 release.
-   Release notes for previous releases can be found on
-   `the Download Page <https://releases.llvm.org/download.html>`_.
+.. only:: PreRelease
+
+  .. warning::
+     These are in-progress notes for the upcoming LLVM |version| release.
+     Release notes for previous releases can be found on
+     `the Download Page <https://releases.llvm.org/download.html>`_.
 
 
 Introduction
 ============
 
 This document contains the release notes for the LLVM Compiler Infrastructure,
-release 14.0.0.  Here we describe the status of LLVM, including major improvements
+release |release|.  Here we describe the status of LLVM, including major improvements
 from the previous release, improvements in various subprojects of LLVM, and
 some of the current users of the code.  All LLVM releases may be downloaded
 from the `LLVM releases web site <https://llvm.org/releases/>`_.

diff  --git a/llvm/docs/conf.py b/llvm/docs/conf.py
index 5be2e8671111c..80aef2202bcd6 100644
--- a/llvm/docs/conf.py
+++ b/llvm/docs/conf.py
@@ -61,15 +61,6 @@
 project = u'LLVM'
 copyright = u'2003-%d, LLVM Project' % date.today().year
 
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short version.
-version = '13'
-# The full version, including alpha/beta/rc tags.
-release = '13'
-
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #language = None

diff  --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index 9ee6eac6ec188..d10058b8c7026 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -1,14 +1,15 @@
-=============================
-Release Notes 14.0 (upcoming)
-=============================
+===========================================
+Release Notes |release| |ReleaseNotesTitle|
+===========================================
 
-In Polly 14 the following important changes have been incorporated.
+In Polly |version| the following important changes have been incorporated.
 
-.. warning::
+.. only:: PreRelease
 
-  These release notes are for the next release of Polly and describe
-  the new features that have recently been committed to our development
-  branch.
+  .. warning::
+    These release notes are for the next release of Polly and describe
+    the new features that have recently been committed to our development
+    branch.
 
 - The command line option -polly-opt-fusion has been removed. What the
   flag does was frequently misunderstood and is rarely useful. However,

diff  --git a/polly/docs/conf.py b/polly/docs/conf.py
index cf757f12d9697..b35c4a2ae9bcc 100644
--- a/polly/docs/conf.py
+++ b/polly/docs/conf.py
@@ -44,15 +44,6 @@
 project = u'Polly'
 copyright = u'2010-%d, The Polly Team' % date.today().year
 
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '14.0-devel'
-# The full version, including alpha/beta/rc tags.
-release = '14.0-devel'
-
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #language = None
@@ -87,6 +78,11 @@
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
 
+in_progress_title = "(In-Progress) " if tags.has("PreRelease") else ""
+
+rst_epilog = f"""
+.. |ReleaseNotesTitle| replace:: {in_progress_title} Release Notes
+"""
 
 # -- Options for HTML output ---------------------------------------------------
 


        


More information about the llvm-commits mailing list