diff --git a/AliceCli/MainMenu.py b/AliceCli/MainMenu.py index 3a73725..f9517d6 100644 --- a/AliceCli/MainMenu.py +++ b/AliceCli/MainMenu.py @@ -24,8 +24,8 @@ from InquirerPy import inquirer from InquirerPy.base.control import Choice from InquirerPy.separator import Separator +from ProjectAlice.core.base.model.Version import Version -from AliceCli.Version import Version from AliceCli.alice.alice import reportBug, systemctl, updateAlice from AliceCli.install.install import installAlice, installAliceSatellite, installSoundDevice, prepareSdCard, uninstallSoundDevice from AliceCli.utils.commons import connect, discover diff --git a/AliceCli/Version.py b/AliceCli/Version.py deleted file mode 100644 index 4c02f67..0000000 --- a/AliceCli/Version.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2021 -# -# This file, Version.py, is part of Project Alice. -# -# Project Alice is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# -# Last modified: 2021.04.13 at 12:56:46 CEST - -from __future__ import annotations - -import re -from dataclasses import dataclass - - -@dataclass(order=True) -class Version(object): - mainVersion: int = 0 - updateVersion: int = 0 - hotfix: int = 0 - # use of release instead of master since release > rc > b > a - releaseType: str = 'release' - releaseNumber: int = 1 - - - @property - def isVersionNumber(self): - return self > Version(0, 0, 0, '', 0) - - - def __str__(self): - if self.releaseType == 'release': - return f'{self.mainVersion}.{self.updateVersion}.{self.hotfix}' - else: - return f'{self.mainVersion}.{self.updateVersion}.{self.hotfix}-{self.releaseType}{self.releaseNumber}' - - - @classmethod - def fromString(cls, versionString: str) -> Version: - versionMatch = re.search( - r'(?P\d+)\.(?P\d+)(?:\.(?P\d+))?(?:-(?Pa|b|rc)(?P\d+)?)?', - str(versionString)) - - # when the string is no version set the version to the lowest possible value - if not versionMatch: - return cls(0, 0, 0, '', 0) - - return cls( - int(versionMatch.group('mainVersion')), - int(versionMatch.group('updateVersion')), - int(versionMatch.group('hotfix') or 0), - versionMatch.group('releaseType') or 'release', - int(versionMatch.group('releaseNumber') or 1)) diff --git a/AliceCli/utils/commons.py b/AliceCli/utils/commons.py index 6d95817..7a1215b 100644 --- a/AliceCli/utils/commons.py +++ b/AliceCli/utils/commons.py @@ -31,13 +31,12 @@ from InquirerPy import inquirer from InquirerPy.base.control import Choice from InquirerPy.separator import Separator +from ProjectAlice.core.base.model.Version import Version from networkscan import networkscan from pathlib import Path from threading import Event, Thread from typing import Optional, Tuple -from AliceCli.Version import Version - IP_REGEX = re.compile(r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$') SSH: Optional[paramiko.SSHClient] = None diff --git a/setup.py b/setup.py index 8690b0c..6ea4544 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( name='projectalice-cli', - version='1.3.20', + version='1.3.21', long_description=Path('README.md').read_text(encoding='utf8'), long_description_content_type='text/markdown', python_requires='>=3.8', @@ -52,7 +52,8 @@ 'pytest-cov~=3.0.0', 'coveralls~=3.3.1', 'tomli~=2.0.0', - 'six~=1.16.0' + 'six~=1.16.0', + 'ProjectAlice' ], classifiers=[ "Development Status :: 5 - Production/Stable",