scripts: fixed cube version validation from config file

This commit is contained in:
hedger 2023-04-22 22:04:03 +04:00 committed by MX
parent 1092cc92be
commit 10efb9590a
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83

View file

@ -34,7 +34,7 @@ class Copro:
self.mcu_copro = None self.mcu_copro = None
self.logger = logging.getLogger(self.__class__.__name__) self.logger = logging.getLogger(self.__class__.__name__)
def loadCubeInfo(self, cube_dir, cube_version): def loadCubeInfo(self, cube_dir, reference_cube_version):
if not os.path.isdir(cube_dir): if not os.path.isdir(cube_dir):
raise Exception(f'"{cube_dir}" doesn\'t exists') raise Exception(f'"{cube_dir}" doesn\'t exists')
self.cube_dir = cube_dir self.cube_dir = cube_dir
@ -50,7 +50,7 @@ class Copro:
if not cube_version or not cube_version.startswith("FW.WB"): if not cube_version or not cube_version.startswith("FW.WB"):
raise Exception(f"Incorrect Cube package or version info") raise Exception(f"Incorrect Cube package or version info")
cube_version = cube_version.replace("FW.WB.", "", 1) cube_version = cube_version.replace("FW.WB.", "", 1)
if cube_version != cube_version: if cube_version != reference_cube_version:
raise Exception(f"Unsupported cube version") raise Exception(f"Unsupported cube version")
self.version = cube_version self.version = cube_version