Help: Parse Copyright.txt instead of using current year
Configure our Sphinx conf.py with a copyright line extracted from Copyright.txt instead of using the year in which the documentation is built. This will future-proof the reported copyright year range when building documentation for old versions.
This commit is contained in:
parent
2bbf6bd7f8
commit
3bade75b02
|
@ -36,6 +36,15 @@ elseif(NOT SPHINX_EXECUTABLE)
|
||||||
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
|
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(copyright_line_regex "^Copyright (2000-20[0-9][0-9] Kitware.*)")
|
||||||
|
file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
|
||||||
|
LIMIT_COUNT 1 REGEX "${copyright_line_regex}")
|
||||||
|
if(copyright_line MATCHES "${copyright_line_regex}")
|
||||||
|
set(conf_copyright "${CMAKE_MATCH_1}")
|
||||||
|
else()
|
||||||
|
set(conf_copyright "Kitware, Inc.")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(conf_docs "${CMake_SOURCE_DIR}/Help")
|
set(conf_docs "${CMake_SOURCE_DIR}/Help")
|
||||||
set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}")
|
set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
set(conf_version "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
|
set(conf_version "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
|
||||||
|
|
|
@ -13,7 +13,6 @@ import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
import time
|
|
||||||
|
|
||||||
sys.path.insert(0, r'@conf_path@')
|
sys.path.insert(0, r'@conf_path@')
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ source_suffix = '.rst'
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
project = 'CMake'
|
project = 'CMake'
|
||||||
copyright = '2000-%s Kitware, Inc.' % time.strftime('%Y')
|
copyright = '@conf_copyright@'
|
||||||
version = '@conf_version@' # feature version
|
version = '@conf_version@' # feature version
|
||||||
release = '@conf_release@' # full version string
|
release = '@conf_release@' # full version string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue