mpflash 0.9.1.post1__py3-none-any.whl → 0.9.1.post2__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/flash/worklist.py CHANGED
@@ -6,12 +6,11 @@ from typing import Dict, List, Optional, Tuple
6
6
  from loguru import logger as log
7
7
 
8
8
  from mpflash.common import FWInfo, filtered_comports
9
+ from mpflash.downloaded import find_downloaded_firmware
9
10
  from mpflash.errors import MPFlashError
10
-
11
- from ..downloaded import find_downloaded_firmware
12
- from ..list import show_mcus
13
- from ..mpboard_id import find_known_board
14
- from ..mpremoteboard import MPRemoteBoard
11
+ from mpflash.list import show_mcus
12
+ from mpflash.mpboard_id import find_known_board
13
+ from mpflash.mpremoteboard import MPRemoteBoard
15
14
 
16
15
  # #########################################################################################################
17
16
  WorkList = List[Tuple[MPRemoteBoard, FWInfo]]
@@ -41,9 +40,7 @@ def auto_update(
41
40
  wl: WorkList = []
42
41
  for mcu in conn_boards:
43
42
  if mcu.family not in ("micropython", "unknown"):
44
- log.warning(
45
- f"Skipping flashing {mcu.family} {mcu.port} {mcu.board} on {mcu.serialport} as it is not a MicroPython firmware"
46
- )
43
+ log.warning(f"Skipping flashing {mcu.family} {mcu.port} {mcu.board} on {mcu.serialport} as it is not a MicroPython firmware")
47
44
  continue
48
45
  board_firmwares = find_downloaded_firmware(
49
46
  fw_folder=fw_folder,
mpflash/versions.py CHANGED
@@ -4,10 +4,13 @@
4
4
  #############################################################
5
5
  """
6
6
 
7
- from cache_to_disk import cache_to_disk, NoCacheCondition
7
+ from pathlib import Path
8
+
9
+ from cache_to_disk import NoCacheCondition, cache_to_disk
8
10
  from loguru import logger as log
9
11
  from packaging.version import parse
10
12
 
13
+ import mpflash.basicgit as git
11
14
  from mpflash.common import GH_CLIENT
12
15
 
13
16
  OLDEST_VERSION = "1.16"
@@ -27,7 +30,7 @@ def clean_version(
27
30
  commit: bool = False,
28
31
  drop_v: bool = False,
29
32
  flat: bool = False,
30
- ):
33
+ ): # sourcery skip: assign-if-exp
31
34
  "Clean up and transform the many flavours of versions"
32
35
  # 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
33
36
  if version in {"", "-"}:
@@ -48,14 +51,12 @@ def clean_version(
48
51
  if len(nibbles) == 1:
49
52
  version = nibbles[0]
50
53
  elif build and not is_preview:
54
+ # HACK: this is not always right, but good enough most of the time
51
55
  version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
56
+ elif is_preview:
57
+ version = "-".join((nibbles[0], V_PREVIEW))
52
58
  else:
53
- # version = "-".join((nibbles[0], LATEST))
54
- # HACK: this is not always right, but good enough most of the time
55
- if is_preview:
56
- version = "-".join((nibbles[0], V_PREVIEW))
57
- else:
58
- version = V_PREVIEW
59
+ version = V_PREVIEW
59
60
  if flat:
60
61
  version = version.strip().replace(".", "_").replace("-", "_")
61
62
  else:
@@ -122,3 +123,13 @@ def get_preview_mp_version() -> str:
122
123
  # read the versions from the git tags
123
124
  all_versions = micropython_versions(minver=OLDEST_VERSION)
124
125
  return [v for v in all_versions if v.endswith(V_PREVIEW)][-1]
126
+
127
+
128
+ # Do not cache , same path will have different versions checked out
129
+ def checkedout_version(path: Path, flat: bool = False) -> str:
130
+ """Get the checked-out version of the repo"""
131
+ version = git.get_local_tag(path.as_posix())
132
+ if not version:
133
+ raise ValueError("No valid Tag found")
134
+ version = clean_version(version, flat=flat, drop_v=False)
135
+ return version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mpflash
3
- Version: 0.9.1.post1
3
+ Version: 0.9.1.post2
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
@@ -29,7 +29,7 @@ mpflash/flash/uf2/linux.py,sha256=4azbcx_YqLZ3RyYNWljejHG_Y6SU-wREL8hhkTYqCjI,40
29
29
  mpflash/flash/uf2/macos.py,sha256=sncXJsc2FVfm9rvLDjcEu7ZIyrDeHmazHiNQTUaf1Y0,1187
30
30
  mpflash/flash/uf2/uf2disk.py,sha256=dQ8_U6e3qkFOyfXZDpWAsvEBIlMr-ZzLkzTDD8SADqM,286
31
31
  mpflash/flash/uf2/windows.py,sha256=k9Yv71YswPnLx-Z5rf4KjhtVkEWr8SU8EXpeRv87h3A,1290
32
- mpflash/flash/worklist.py,sha256=K16sbvzJCgkHNssYlBA3ezayI02RMuIcp19XAs74XeQ,5835
32
+ mpflash/flash/worklist.py,sha256=1uBvn-T35Oey04g6xxNxo5t68q5_tp18eZcRAamF0tY,5828
33
33
  mpflash/list.py,sha256=O0tX4BvclmDMnnjMxCN9Zh8hdL6vnuvS9pLNxYLBya8,3112
34
34
  mpflash/logger.py,sha256=BAVrSXMGZLfSDRFbtVBtvb7Rl0sTJxooCgBS5t-6bXo,1057
35
35
  mpflash/mpboard_id/__init__.py,sha256=rQrPCN30GP-lfB2a2deA-lQ6iKvaKPK_xbtBoIavGsM,3716
@@ -45,9 +45,9 @@ mpflash/vendor/click_aliases.py,sha256=K98inhtze8td1dw312kexJS7OX_0ojlptPQ5Z0SHx
45
45
  mpflash/vendor/dfu.py,sha256=jGsiD3lbSV1Ar9qJubhoY_hy-L8FI-K55aow8vgwoYQ,5590
46
46
  mpflash/vendor/pydfu.py,sha256=1ObubGsPFrQ7T9M3JRlIPNIG2xx8uYffaEe0Y6bdf_g,19937
47
47
  mpflash/vendor/readme.md,sha256=ZVg7kuUYyXcWcrWkaSJ0CunwebCqu2SiS2sqDadwrT8,84
48
- mpflash/versions.py,sha256=SrXVZx6qVWcighHlg8pJ0RPRZ3gcYN7l2DnSicconAk,4098
49
- mpflash-0.9.1.post1.dist-info/LICENSE,sha256=xHwgxGNkI0R2iN4KNfbPbQSzRomWyRz7bJnR1O2mln8,1057
50
- mpflash-0.9.1.post1.dist-info/METADATA,sha256=ZXUp9Y65hBRqeXjcZx4O6NQL_Jg8vZnQ6ROqDl6V86U,16064
51
- mpflash-0.9.1.post1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
- mpflash-0.9.1.post1.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
53
- mpflash-0.9.1.post1.dist-info/RECORD,,
48
+ mpflash/versions.py,sha256=x5VrdVfWhZJfH7tZmwu2vVx-mPrK1iunYSpSce9VUXU,4492
49
+ mpflash-0.9.1.post2.dist-info/LICENSE,sha256=xHwgxGNkI0R2iN4KNfbPbQSzRomWyRz7bJnR1O2mln8,1057
50
+ mpflash-0.9.1.post2.dist-info/METADATA,sha256=SFrk166YQmHI5NcNGZYbOmSx9O2D1r9zvG-DxKs26EM,16064
51
+ mpflash-0.9.1.post2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
+ mpflash-0.9.1.post2.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
53
+ mpflash-0.9.1.post2.dist-info/RECORD,,