mpflash 1.24.4__py3-none-any.whl → 1.24.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mpflash/versions.py CHANGED
@@ -1,14 +1,12 @@
1
1
  """
2
- #############################################################
3
- # Version handling copied from stubber/utils/versions.py
4
- #############################################################
2
+ Version handling for mpflash and micropython-stubber
5
3
  """
6
4
 
7
5
  from pathlib import Path
8
6
 
9
7
  from cache_to_disk import NoCacheCondition, cache_to_disk
10
8
  from loguru import logger as log
11
- from packaging.version import parse
9
+ from packaging.version import Version, parse
12
10
 
13
11
  import mpflash.basicgit as git
14
12
  from mpflash.common import GH_CLIENT
@@ -71,6 +69,11 @@ def clean_version(
71
69
  return version
72
70
 
73
71
 
72
+ def is_version(version: str):
73
+ """Check if the version is a valid version string"""
74
+ return Version._regex.search(version) is not None
75
+
76
+
74
77
  @cache_to_disk(n_days_to_cache=1)
75
78
  def micropython_versions(minver: str = "v1.20", reverse: bool = False, cache_it=True):
76
79
  """Get the list of micropython versions from github tags"""
@@ -106,7 +109,8 @@ def micropython_versions(minver: str = "v1.20", reverse: bool = False, cache_it=
106
109
  versions = [v for v in versions if parse(v) >= parse(minver)]
107
110
  # remove all but the most recent (preview) version
108
111
  versions = versions[:1] + [v for v in versions if "preview" not in v]
109
- versions = sorted(versions, reverse=reverse)
112
+ # remove any duplicates and sort
113
+ versions = sorted(list(set(versions)), reverse=reverse, key=lambda s: (not is_version(s), s))
110
114
  if cache_it:
111
115
  return versions
112
116
  # returns - but does not cache
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mpflash
3
- Version: 1.24.4
3
+ Version: 1.24.5
4
4
  Summary: Flash and download tool for MicroPython firmwares
5
5
  Home-page: https://github.com/Josverl/micropython-stubber/blob/main/src/mpflash/README.md
6
6
  License: MIT
@@ -45,9 +45,9 @@ mpflash/vendor/click_aliases.py,sha256=c853EHSlkE2DvFqeFvFpwXKuJj3_jsXDP7iotVOKa
45
45
  mpflash/vendor/dfu.py,sha256=ZXMcE6aH4-43Wh4tbQT4U-q-BU3RUiL3JAxmP_QAK2s,5755
46
46
  mpflash/vendor/pydfu.py,sha256=_MdBRo1EeNeKDqFPSTB5tNL1jGSBJgsVeVjE5e7Pb8s,20542
47
47
  mpflash/vendor/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
48
- mpflash/versions.py,sha256=5XhbR5Ef2291zBaDTcrfDjCl8iAIiuJKVfV6oNpPofY,4628
49
- mpflash-1.24.4.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
50
- mpflash-1.24.4.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
51
- mpflash-1.24.4.dist-info/METADATA,sha256=eaCZR_hPWzmClWI-rMSs0CMKf3MT39oRlKIgaHyr8zY,17651
52
- mpflash-1.24.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
53
- mpflash-1.24.4.dist-info/RECORD,,
48
+ mpflash/versions.py,sha256=pKl-4GPHTs3_p73xywxSvsouZ3L4R2ljXSCkWj9U8HE,4742
49
+ mpflash-1.24.5.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
50
+ mpflash-1.24.5.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
51
+ mpflash-1.24.5.dist-info/METADATA,sha256=mJfXKJ0R5EkBVnMLyRoixlpC2DmgbTj3ehYAdoTTzw4,17651
52
+ mpflash-1.24.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
53
+ mpflash-1.24.5.dist-info/RECORD,,