diff --git a/CMakeLists.txt b/CMakeLists.txt index fb9d4b28..aafca4f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.16) # make_dist expects the version line to be on a line by itself after # the project line. When updating the version, check make_dist for all -# the places it has to be updated. +# the places it has to be updated. The doc configuration and CI build +# also find the version number here. project(qpdf VERSION 11.7.0 LANGUAGES C CXX) diff --git a/build-scripts/build-doc b/build-scripts/build-doc index e6c72757..7d45d4fa 100755 --- a/build-scripts/build-doc +++ b/build-scripts/build-doc @@ -10,7 +10,7 @@ pip3 install sphinx sphinx_rtd_theme cmake -S . -B build -DBUILD_DOC=1 cmake --build build --verbose --target doc_dist zip -r doc.zip build/manual/doc-dist -version=$(grep -E '^release' manual/conf.py | cut -d"'" -f 2) +version=$(grep -E '^ +VERSION [1-9]' CMakeLists.txt | awk '{print $2}') mv build/manual/doc-dist qpdf-${version}-doc mkdir distribution zip -r distribution/qpdf-${version}-doc-ci.zip qpdf-${version}-doc diff --git a/make_dist b/make_dist index acbf71e3..020852eb 100755 --- a/make_dist +++ b/make_dist @@ -59,7 +59,6 @@ cd($tmpdir); # Check versions my $cmakeversion = get_version_from_cmake(); my $code_version = get_version_from_source(); -my $doc_version = get_version_from_manual(); my $version_error = 0; if ($version ne $cmakeversion) @@ -72,11 +71,6 @@ if ($version ne $code_version) print "$whoami: QPDF.cc version = $code_version\n"; $version_error = 1; } -if ($version ne $doc_version) -{ - print "$whoami: doc version = $doc_version\n"; - $version_error = 1; -} if ($version_error) { die "$whoami: version numbers are not consistent\n"; @@ -157,22 +151,6 @@ sub get_version_from_source $code_version; } -sub get_version_from_manual -{ - my $fh = safe_open("manual/conf.py"); - my $doc_version = 'unknown'; - while (<$fh>) - { - if (m/release = '([^\']+)\'/) - { - $doc_version = $1; - last; - } - } - $fh->close(); - $doc_version; -} - sub safe_open { my $file = shift; diff --git a/manual/conf.py b/manual/conf.py index b95eb3c6..9d4eb5ec 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -15,8 +15,12 @@ sys.path.append(os.path.abspath("./_ext")) project = 'QPDF' copyright = '2005-2023, Jay Berkenbilt' author = 'Jay Berkenbilt' -# make_dist and the CI build lexically find the release version from this file. -release = '11.7.0' +here = os.path.dirname(os.path.realpath(__file__)) +with open(f'{here}/../CMakeLists.txt') as f: + for line in f.readlines(): + if line.strip().startswith('VERSION '): + release = line.replace('VERSION', '').strip() + break version = release extensions = [ 'sphinx_rtd_theme',