Allow 2 digit versions. Fixes #483
pull/469/head
Holger Müller 2022-04-01 16:29:19 +02:00
rodzic 69cc2dcfb4
commit f68d3c2fb7
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
VERSION = "0.4.0-pre" VERSION = "0.4.0"
VERSION_URL = ( VERSION_URL = (
"https://raw.githubusercontent.com/" "https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py") "NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")

Wyświetl plik

@ -15,8 +15,10 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from lib2to3.pytree import type_repr
import logging import logging
import re import re
from typing import Type
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -25,8 +27,8 @@ class Version:
RXP = re.compile(r"""^ RXP = re.compile(r"""^
\D* \D*
(?P<major>\d+)\. (?P<major>\d+)\.
(?P<minor>\d+)\. (?P<minor>\d+)\.?
(?P<revision>\d+) (?P<revision>\d+)?
(?P<note>.*) (?P<note>.*)
$""", re.VERBOSE) $""", re.VERBOSE)
@ -41,6 +43,8 @@ class Version:
self.data = Version.RXP.search(vstring).groupdict() self.data = Version.RXP.search(vstring).groupdict()
for name in ("major", "minor", "revision"): for name in ("major", "minor", "revision"):
self.data[name] = int(self.data[name]) self.data[name] = int(self.data[name])
except TypeError:
self.data["revision"] = 0
except AttributeError: except AttributeError:
logger.error("Unable to parse version: %s", vstring) logger.error("Unable to parse version: %s", vstring)