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.
This commit is contained in:
Ben McGinnes 2018-11-22 18:00:22 +11:00
parent b182838f71
commit de6bb23279

View File

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