From de6bb23279796b9ae4dc369d58591cb75f818684 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Thu, 22 Nov 2018 18:00:22 +1100 Subject: [PATCH] python: version as integers * lang/python/version.py.in: added gpg.version.versionintlist * If gpg.version.versionintlist[2] ever returns -1 then there's a serious problem with the build and it should be lodged as a bug if it's repeatable. Seeing this should never happen, but checking for it is better than not doing so. --- lang/python/version.py.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lang/python/version.py.in b/lang/python/version.py.in index ad76edab..0388cda4 100644 --- a/lang/python/version.py.in +++ b/lang/python/version.py.in @@ -28,12 +28,32 @@ productname = 'gpg' versionstr = "@VERSION@" gpgme_versionstr = gpgme.GPGME_VERSION in_tree_build = bool(gpgme.cvar.gpg_in_tree_build) +is_beta = False versionlist = versionstr.split(".") major = versionlist[0] minor = versionlist[1] patch = versionlist[2] +versionintlist = [] +versionintlist.append(int(major)) +versionintlist.append(int(minor)) + +try: + int(patch) +except ValueError as e: + is_beta = True + +if is_beta is False: + versionintlist.append(int(patch)) +else: + try: + beta_patch = patch.split("-") + versionintlist.append(int(beta_patch[0])) + except Exception as e: + # This should never happen, if it does then lodge a bug report. + versionintlist.append(-1) + copyright = """\ Copyright (C) 2016-2018 g10 Code GmbH Copyright (C) 2015 Benjamin D. McGinnes