Description: Update semver calls to use non-deprecated functions
 semver.parse and semver.compare are deprecated and will be removed
 in semver 3
Author: Nick Morrott <nickm@debian.org>
Forwarded: not-needed
Last-Update: 2022-02-15
---
--- a/mu/modes/microbit.py
+++ b/mu/modes/microbit.py
@@ -338,24 +338,22 @@
                     # in the "release" field.
                     try:
                         # Check the release is a correct semantic version.
-                        semver.parse(version_info['release'])
-                        board_version = version_info['release']
+                        board_version = semver.VersionInfo.parse(version_info['release'])
                     except ValueError:
                         # If it's an invalid semver, set to unknown version to
                         # force flash.
-                        board_version = '0.0.1'
+                        board_version = semver.VersionInfo.parse('0.0.1')
                 else:
                     # 0.0.1 indicates an old unknown version. This is just a
                     # valid arbitrary flag for semver comparison a couple of
                     # lines below.
-                    board_version = '0.0.1'
+                    board_version = semver.VersionInfo.parse('0.0.1')
                 logger.info('Board MicroPython: {}'.format(board_version))
                 logger.info(
                     'Mu MicroPython: {}'.format(uflash.MICROPYTHON_VERSION))
                 # If there's an older version of MicroPython on the device,
                 # update it with the one packaged with Mu.
-                if semver.compare(board_version,
-                                  uflash.MICROPYTHON_VERSION) < 0:
+                if board_version.compare(uflash.MICROPYTHON_VERSION) < 0:
                     force_flash = True
             except Exception:
                 # Could not get version of MicroPython. This means either the
