def _update_stm_firmware_fn(self): try: if self._firmware_update_thread.is_alive(): return except AttributeError: pass current_fw_version = parse_version(self.piksi_stm_vers) re_result = re.search('[a-zA-Z0-9]*-(v[0-9]*\.[0-9]*\.[0-9])', self.stm_fw.status) intended_version = parse_version(re_result.group(1)) # If the current firmware is not yet beyond 2.0.0, and we are loading beyond 2.0.0 # warn the user that this upgrade is not possible if (current_fw_version < pkparse_version("v2.0.0") and intended_version > pkparse_version("v2.0.0")): confirm_prompt = prompt.CallbackPrompt( title="Update to v2.0.0", actions=[prompt.close_button, prompt.ok_button], callback=self._replace_with_version_2) confirm_prompt.text = "\n" \ + " Upgrading to firmware v2.1.0 or later requires that the device be \n" \ + " running firmware v2.0.0 or later. Please upgrade to firmware \n" \ + " version 2.0.0. \n" \ + " \n" \ + " Would you like to download firmware version v2.0.0 now? \n" \ + " \n" confirm_prompt.run(block=False) return self._firmware_update_thread = Thread( target=self.manage_firmware_updates, args=("STM", )) self._firmware_update_thread.start()
def parse_version(version): comp_string = version if version[0] == 'v': version = version[1:-1] pkparse_version(version.replace( "dirty", "", ))
def parse_version(version): if version[0] == 'v': version = version[1:] return pkparse_version(version.replace( "-dirty", "", ))
def parse_version(version): comp_string = version if version[0] == 'v': version = version[1:] return pkparse_version(version.replace( "dirty", "", ))