Commit 273eaf4682ba11c1c1fcfdcda31d0c95211599a2
1 parent
17c5b950
Remove hard-coded version from manual/conf.py
Showing
4 changed files
with
9 additions
and
26 deletions
CMakeLists.txt
| ... | ... | @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.16) |
| 3 | 3 | |
| 4 | 4 | # make_dist expects the version line to be on a line by itself after |
| 5 | 5 | # the project line. When updating the version, check make_dist for all |
| 6 | -# the places it has to be updated. | |
| 6 | +# the places it has to be updated. The doc configuration and CI build | |
| 7 | +# also find the version number here. | |
| 7 | 8 | project(qpdf |
| 8 | 9 | VERSION 11.7.0 |
| 9 | 10 | LANGUAGES C CXX) | ... | ... |
build-scripts/build-doc
| ... | ... | @@ -10,7 +10,7 @@ pip3 install sphinx sphinx_rtd_theme |
| 10 | 10 | cmake -S . -B build -DBUILD_DOC=1 |
| 11 | 11 | cmake --build build --verbose --target doc_dist |
| 12 | 12 | zip -r doc.zip build/manual/doc-dist |
| 13 | -version=$(grep -E '^release' manual/conf.py | cut -d"'" -f 2) | |
| 13 | +version=$(grep -E '^ +VERSION [1-9]' CMakeLists.txt | awk '{print $2}') | |
| 14 | 14 | mv build/manual/doc-dist qpdf-${version}-doc |
| 15 | 15 | mkdir distribution |
| 16 | 16 | zip -r distribution/qpdf-${version}-doc-ci.zip qpdf-${version}-doc | ... | ... |
make_dist
| ... | ... | @@ -59,7 +59,6 @@ cd($tmpdir); |
| 59 | 59 | # Check versions |
| 60 | 60 | my $cmakeversion = get_version_from_cmake(); |
| 61 | 61 | my $code_version = get_version_from_source(); |
| 62 | -my $doc_version = get_version_from_manual(); | |
| 63 | 62 | |
| 64 | 63 | my $version_error = 0; |
| 65 | 64 | if ($version ne $cmakeversion) |
| ... | ... | @@ -72,11 +71,6 @@ if ($version ne $code_version) |
| 72 | 71 | print "$whoami: QPDF.cc version = $code_version\n"; |
| 73 | 72 | $version_error = 1; |
| 74 | 73 | } |
| 75 | -if ($version ne $doc_version) | |
| 76 | -{ | |
| 77 | - print "$whoami: doc version = $doc_version\n"; | |
| 78 | - $version_error = 1; | |
| 79 | -} | |
| 80 | 74 | if ($version_error) |
| 81 | 75 | { |
| 82 | 76 | die "$whoami: version numbers are not consistent\n"; |
| ... | ... | @@ -157,22 +151,6 @@ sub get_version_from_source |
| 157 | 151 | $code_version; |
| 158 | 152 | } |
| 159 | 153 | |
| 160 | -sub get_version_from_manual | |
| 161 | -{ | |
| 162 | - my $fh = safe_open("manual/conf.py"); | |
| 163 | - my $doc_version = 'unknown'; | |
| 164 | - while (<$fh>) | |
| 165 | - { | |
| 166 | - if (m/release = '([^\']+)\'/) | |
| 167 | - { | |
| 168 | - $doc_version = $1; | |
| 169 | - last; | |
| 170 | - } | |
| 171 | - } | |
| 172 | - $fh->close(); | |
| 173 | - $doc_version; | |
| 174 | -} | |
| 175 | - | |
| 176 | 154 | sub safe_open |
| 177 | 155 | { |
| 178 | 156 | my $file = shift; | ... | ... |
manual/conf.py
| ... | ... | @@ -15,8 +15,12 @@ sys.path.append(os.path.abspath("./_ext")) |
| 15 | 15 | project = 'QPDF' |
| 16 | 16 | copyright = '2005-2023, Jay Berkenbilt' |
| 17 | 17 | author = 'Jay Berkenbilt' |
| 18 | -# make_dist and the CI build lexically find the release version from this file. | |
| 19 | -release = '11.7.0' | |
| 18 | +here = os.path.dirname(os.path.realpath(__file__)) | |
| 19 | +with open(f'{here}/../CMakeLists.txt') as f: | |
| 20 | + for line in f.readlines(): | |
| 21 | + if line.strip().startswith('VERSION '): | |
| 22 | + release = line.replace('VERSION', '').strip() | |
| 23 | + break | |
| 20 | 24 | version = release |
| 21 | 25 | extensions = [ |
| 22 | 26 | 'sphinx_rtd_theme', | ... | ... |