barectf/__init__.py: build version string instead of parsing it
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 14 May 2020 16:47:24 +0000 (12:47 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 14 May 2020 16:47:24 +0000 (12:47 -0400)
This is more natural and less complicated.

Leaving get_version_tuple() as some modules use it.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/__init__.py
doc/man/Makefile
doc/man/barectf.1

index f13bb191d357ffe324d0efba12f815ae5d1ddaca..ca03db164364c305c94eae84c549d3359a514cef 100644 (file)
@@ -1,6 +1,6 @@
 # The MIT License (MIT)
 #
-# Copyright (c) 2014-2016 Philippe Proulx <pproulx@efficios.com>
+# Copyright (c) 2014-2020 Philippe Proulx <pproulx@efficios.com>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
-__version__ = '2.3.1'
-
-
-def _split_version_suffix():
-    parts = __version__.split('-')
-    version = parts[0]
-    suffix = None
-
-    if len(parts) == 2:
-        suffix = parts[1]
-
-    return version, suffix
+__major_version__ = 2
+__minor_version__ = 3
+__patch_version__ = 1
+__version__ = '{}.{}.{}'.format(__major_version__, __minor_version__,
+                                __patch_version__)
 
 
 def get_version_tuple():
-    version, suffix = _split_version_suffix()
-    parts = version.split('.')
-
-    return (int(parts[0]), int(parts[1]), int(parts[2]))
-
-
-def get_version_suffix():
-    return _split_version_suffix()[1]
+    return __major_version__, __minor_version__, __patch_version__
index 5311f7f5bddee84c7ac5c2a472dde2111fc32675..4c79ad0828b491c882a5a99814806f983ba5f0d6 100644 (file)
@@ -36,7 +36,7 @@ XSL_SRC_FILES = $(addprefix xsl/,$(XSL_FILES))
 ASCIIDOC ?= asciidoc
 XMLTO ?= xmlto
 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
-       -a barectf_version=$(shell grep '^__version__' ../../barectf/__init__.py | grep -Po '\d+\.\d+\.\d+(?:-\w+)?')
+       -a barectf_version=$(shell cd ../../barectf; python3 -c 'import __init__; print(__init__.__version__)')
 ADOC_DOCBOOK = $(ADOC) -b docbook
 XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
 
index 457a392be1b3276d2e9874c6ada645b4ff8bd39d..758c37de244defb3486c4126154b2e5912fdefdb 100644 (file)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: barectf
 .\"    Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 11/15/2016
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 05/14/2020
 .\"    Manual: barectf manual
-.\"    Source: barectf 2.2.1
+.\"    Source: barectf 2.3.1
 .\"  Language: English
 .\"
-.TH "BARECTF" "1" "11/15/2016" "barectf 2\&.2\&.1" "barectf manual"
+.TH "BARECTF" "1" "05/14/2020" "barectf 2\&.3\&.1" "barectf manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
This page took 0.024937 seconds and 4 git commands to generate.