mirror of
https://github.com/fmtlib/fmt.git
synced 2024-09-02 21:19:26 +00:00
Read version from CMakeLists.txt instead of using configure for compatibility with ReadTheDocs.
This commit is contained in:
parent
2a1c0c9969
commit
d91a66e1c5
@ -151,11 +151,7 @@ if (EXISTS .gitignore)
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR 0)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR 10)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH 0)
|
||||
set(CPPFORMAT_VERSION
|
||||
${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME cppformat-${CPPFORMAT_VERSION})
|
||||
set(CPACK_RESOURCE_FILE_README ${FORMAT_SOURCE_DIR}/README.rst)
|
||||
include(CPack)
|
||||
endif ()
|
||||
|
||||
configure_file(doc/conf.py.in doc/conf.py @ONLY)
|
||||
|
@ -11,7 +11,7 @@
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
import sys, os, re
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
@ -49,6 +49,16 @@ master_doc = 'index'
|
||||
project = u'C++ Format'
|
||||
copyright = u'2012-2014, Victor Zverovich'
|
||||
|
||||
# Get version from CMakeLists.txt.
|
||||
version = {}
|
||||
with open('../CMakeLists.txt') as f:
|
||||
for line in f:
|
||||
m = re.match(r'set\(CPACK_PACKAGE_VERSION_([A-Z]+) ([0-9]+)\)', line.strip())
|
||||
if m:
|
||||
kind, value = m.groups()
|
||||
version[kind] = value
|
||||
version = '{}.{}.{}'.format(version['MAJOR'], version['MINOR'], version['PATCH'])
|
||||
|
||||
# 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.
|
Loading…
Reference in New Issue
Block a user