mpflash 1.0.3__tar.gz → 1.0.5__tar.gz
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-1.0.3 → mpflash-1.0.5}/PKG-INFO +1 -1
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/basicgit.py +27 -7
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/common.py +2 -5
- {mpflash-1.0.3 → mpflash-1.0.5}/pyproject.toml +1 -1
- mpflash-1.0.3/mpflash/mpboard_id/boardinfo.csv +0 -2389
- {mpflash-1.0.3 → mpflash-1.0.5}/LICENSE +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/README.md +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/add_firmware.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/ask_input.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/activate.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/detect.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/manual.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/micropython.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/bootloader/touch1200.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/cli_download.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/cli_flash.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/cli_group.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/cli_list.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/cli_main.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/config.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/connected.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/download.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/downloaded.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/errors.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/esp.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/stm32.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/stm32_dfu.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/boardid.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/linux.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/macos.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/uf2disk.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/uf2/windows.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/flash/worklist.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/list.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/logger.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/add_boards.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/board.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/board_id.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/board_info.zip +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpboard_id/store.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpremoteboard/__init__.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpremoteboard/mpy_fw_info.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/mpremoteboard/runner.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/vendor/click_aliases.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/vendor/dfu.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/vendor/pydfu.py +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/vendor/readme.md +0 -0
- {mpflash-1.0.3 → mpflash-1.0.5}/mpflash/versions.py +0 -0
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
10
10
|
from typing import List, Optional, Union
|
11
11
|
|
12
12
|
import cachetools.func
|
13
|
-
from github import Auth, Github
|
13
|
+
from github import Auth, BadCredentialsException, Github
|
14
14
|
from loguru import logger as log
|
15
15
|
from packaging.version import parse
|
16
16
|
|
@@ -18,7 +18,11 @@ from packaging.version import parse
|
|
18
18
|
|
19
19
|
# Token with no permissions to avoid throttling
|
20
20
|
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
|
21
|
-
PAT_NO_ACCESS =
|
21
|
+
PAT_NO_ACCESS = (
|
22
|
+
"github_pat_"
|
23
|
+
+ "11AAHPVFQ0G4NTaQ73Bw5J"
|
24
|
+
+ "_fAp7K9sZ1qL8VFnI9g78eUlCdmOXHB3WzSdj2jtEYb4XF3N7PDJBl32qIxq"
|
25
|
+
)
|
22
26
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
23
27
|
GH_CLIENT = Github(auth=Auth.Token(PAT))
|
24
28
|
|
@@ -35,9 +39,17 @@ def _run_local_git(
|
|
35
39
|
if repo:
|
36
40
|
if isinstance(repo, str):
|
37
41
|
repo = Path(repo)
|
38
|
-
result = subprocess.run(
|
42
|
+
result = subprocess.run(
|
43
|
+
cmd,
|
44
|
+
capture_output=capture_output,
|
45
|
+
check=True,
|
46
|
+
cwd=repo.absolute().as_posix(),
|
47
|
+
encoding="utf-8",
|
48
|
+
)
|
39
49
|
else:
|
40
|
-
result = subprocess.run(
|
50
|
+
result = subprocess.run(
|
51
|
+
cmd, capture_output=capture_output, check=True, encoding="utf-8"
|
52
|
+
)
|
41
53
|
except (NotADirectoryError, FileNotFoundError) as e: # pragma: no cover
|
42
54
|
return None
|
43
55
|
except subprocess.CalledProcessError as e: # pragma: no cover
|
@@ -76,7 +88,9 @@ def clone(remote_repo: str, path: Path, shallow: bool = False, tag: Optional[str
|
|
76
88
|
return False
|
77
89
|
|
78
90
|
|
79
|
-
def get_local_tag(
|
91
|
+
def get_local_tag(
|
92
|
+
repo: Optional[Union[str, Path]] = None, abbreviate: bool = True
|
93
|
+
) -> Union[str, None]:
|
80
94
|
"""
|
81
95
|
get the most recent git version tag of a local repo
|
82
96
|
repo Path should be in the form of : repo = "./repo/micropython"
|
@@ -125,12 +139,16 @@ def get_local_tags(repo: Optional[Path] = None, minver: Optional[str] = None) ->
|
|
125
139
|
@cachetools.func.ttl_cache(maxsize=16, ttl=60) # 60 seconds
|
126
140
|
def get_tags(repo: str, minver: Optional[str] = None) -> List[str]:
|
127
141
|
"""
|
128
|
-
Get list of tag of a repote github repo
|
142
|
+
Get list of tag of a repote github repo.
|
143
|
+
only the last -preview tag is kept
|
129
144
|
"""
|
130
145
|
if not repo or not isinstance(repo, str) or "/" not in repo: # type: ignore
|
131
146
|
return []
|
132
147
|
try:
|
133
148
|
gh_repo = GH_CLIENT.get_repo(repo)
|
149
|
+
except BadCredentialsException as e:
|
150
|
+
log.error(f"Github authentication error - {e}")
|
151
|
+
return []
|
134
152
|
except ConnectionError as e:
|
135
153
|
# TODO: unable to capture the exeption
|
136
154
|
log.warning(f"Unable to get tags - {e}")
|
@@ -138,7 +156,9 @@ def get_tags(repo: str, minver: Optional[str] = None) -> List[str]:
|
|
138
156
|
tags = [tag.name for tag in gh_repo.get_tags()]
|
139
157
|
if minver:
|
140
158
|
tags = [tag for tag in tags if parse(tag) >= parse(minver)]
|
141
|
-
|
159
|
+
# remove all but the last preview
|
160
|
+
tags = [t for t in sorted(tags[:-1]) if "-preview" not in t] + sorted(tags)[-1:]
|
161
|
+
return tags
|
142
162
|
|
143
163
|
|
144
164
|
def checkout_tag(tag: str, repo: Optional[Union[str, Path]] = None) -> bool:
|
@@ -30,11 +30,8 @@ PORT_FWTYPES = {
|
|
30
30
|
|
31
31
|
# Token with no permissions to avoid throttling
|
32
32
|
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
|
33
|
-
PAT_NO_ACCESS =
|
34
|
-
|
35
|
-
+ "_11AAHPVFQ0qAkDnSUaMKSp"
|
36
|
-
+ "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
|
37
|
-
)
|
33
|
+
PAT_NO_ACCESS = "github_pat_"+"11AAHPVFQ0G4NTaQ73Bw5J"+"_fAp7K9sZ1qL8VFnI9g78eUlCdmOXHB3WzSdj2jtEYb4XF3N7PDJBl32qIxq"
|
34
|
+
|
38
35
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
39
36
|
GH_CLIENT = Github(auth=Auth.Token(PAT))
|
40
37
|
|