diff --git a/NanoVNASaver/About.py b/NanoVNASaver/About.py index ca304ca8..94e0c143 100644 --- a/NanoVNASaver/About.py +++ b/NanoVNASaver/About.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -VERSION = "0.4.0-pre" +VERSION = "0.4.0" VERSION_URL = ( "https://raw.githubusercontent.com/" "NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py") diff --git a/NanoVNASaver/Version.py b/NanoVNASaver/Version.py index 01fe5caa..3ab85249 100644 --- a/NanoVNASaver/Version.py +++ b/NanoVNASaver/Version.py @@ -15,8 +15,10 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from lib2to3.pytree import type_repr import logging import re +from typing import Type logger = logging.getLogger(__name__) @@ -25,8 +27,8 @@ class Version: RXP = re.compile(r"""^ \D* (?P\d+)\. - (?P\d+)\. - (?P\d+) + (?P\d+)\.? + (?P\d+)? (?P.*) $""", re.VERBOSE) @@ -41,6 +43,8 @@ def __init__(self, vstring: str = "0.0.0"): self.data = Version.RXP.search(vstring).groupdict() for name in ("major", "minor", "revision"): self.data[name] = int(self.data[name]) + except TypeError: + self.data["revision"] = 0 except AttributeError: logger.error("Unable to parse version: %s", vstring)