diff options
author | Ben McGinnes <ben@adversary.org> | 2018-11-22 18:00:22 +1100 |
---|---|---|
committer | Ben McGinnes <ben@adversary.org> | 2018-11-22 18:00:22 +1100 |
commit | de6bb23279796b9ae4dc369d58591cb75f818684 (patch) | |
tree | 1530a4a718936d1ec0bb910dc3373455d328495a | |
parent | b182838f71d8349d6cd7be9ecfb859b893d09127 (diff) | |
download | gpgme-de6bb23279796b9ae4dc369d58591cb75f818684.tar.gz |
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.
-rw-r--r-- | lang/python/version.py.in | 20 |
1 files changed, 20 insertions, 0 deletions
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 |