From 269a2182044b8ca887be2436f8cab002c21da1c3 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Fri, 14 Aug 2020 11:53:22 +0200 Subject: [PATCH] Change to all-numeric version entry format and add collection The version is now specified with a new collection variable which shall be "stable" or "development" and an all-numeric version. The "~dev" (and the .) suffix will be added by the script. --- gen_version.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/gen_version.py b/gen_version.py index 201af59c0..35679bfb8 100644 --- a/gen_version.py +++ b/gen_version.py @@ -2,25 +2,27 @@ # Generate version # -# Stable release entry format : ..>patch> -# Development release entry format: ..~dev +# Release version entry format : .. # -# Stable release output format : .. -# Development release output format: ..~dev. +# Stable release version output format : .. +# Development release version output format: ..~dev. -# The patch version of a development release should be the next stable -# release patch number followed by "~dev". The committer date will be -# added with a period separator. +# The patch version of a development release should be the same as the +# next stable release patch number. The string "~dev." and the +# committer date will be added. # # Example sequence: # -# Entry Output -# 2.44.1 => 2.44.1 -# 2.44.2~dev => 2.44.2~dev.20200704.1652 -# 2.44.2 => 2.44.2 -# 2.44.3~dev => 2.44.3~dev.20200824.1337 +# Entry version Entry collection Output +# 2.44.1 stable => 2.44.1 +# 2.44.2 development => 2.44.2~dev.20200704.1652 +# 2.44.2 stable => 2.44.2 +# 2.44.3 development => 2.44.3~dev.20200824.1337 -version = '2.44.2~dev' +#collection = 'stable' +collection = 'development' + +version = '2.44.2' import os import sys @@ -51,6 +53,15 @@ args = parser.parse_args() date_format = args.date_format or graphviz_date_format +assert collection in ('stable', 'development'), \ + 'The collection is not "stable" or "development"' +assert len(version.split('.')) == 3, 'Wrong number of version elements' +assert all(part.isnumeric() for part in version.split('.')), \ + 'All version elements are not numeric' + +if collection == 'development': + version += '~dev' + major_version, minor_version, patch_version = version.split('.') if not patch_version.isnumeric() or args.date_format: -- 2.40.0