Remove hard-coded version from manual/conf.py

This commit is contained in:
Jay Berkenbilt 2023-12-16 11:00:37 -05:00
parent 17c5b950c8
commit 273eaf4682
4 changed files with 9 additions and 26 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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',