From 7ec950c44ccc815aaee3eb77daf8d8dde5066d45 Mon Sep 17 00:00:00 2001 From: Caila Marashaj <98041399+caila-marashaj@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:07:04 -0400 Subject: [PATCH] refactor(modules): return has update for unexpected module fw filename (#14712) --- .../opentrons/hardware_control/modules/mod_abc.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/src/opentrons/hardware_control/modules/mod_abc.py b/api/src/opentrons/hardware_control/modules/mod_abc.py index c6ea41437eb..4355b77413d 100644 --- a/api/src/opentrons/hardware_control/modules/mod_abc.py +++ b/api/src/opentrons/hardware_control/modules/mod_abc.py @@ -4,7 +4,7 @@ import re from pkg_resources import parse_version from typing import ClassVar, Mapping, Optional, cast, TypeVar - +from packaging.version import InvalidVersion from opentrons.config import IS_ROBOT, ROBOT_FIRMWARE_DIR from opentrons.drivers.rpi_drivers.types import USBPort @@ -88,8 +88,15 @@ def get_bundled_fw(self) -> Optional[BundledFirmware]: def has_available_update(self) -> bool: """Return whether a newer firmware file is available""" if self.device_info and self._bundled_fw: - device_version = parse_version(self.device_info["version"]) - available_version = parse_version(self._bundled_fw.version) + # try catch this + try: + device_version = parse_version(self.device_info["version"]) + except InvalidVersion: + device_version = parse_version("v0.0.0") + try: + available_version = parse_version(self._bundled_fw.version) + except InvalidVersion: + available_version = parse_version("v0.0.0") return cast(bool, available_version > device_version) return False