mpflash 1.0.0__py3-none-any.whl → 1.0.1__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/common.py CHANGED
@@ -29,7 +29,9 @@ PORT_FWTYPES = {
29
29
  # Token with no permissions to avoid throttling
30
30
  # 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
31
31
  PAT_NO_ACCESS = (
32
- "github_pat" + "_11AAHPVFQ0qAkDnSUaMKSp" + "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
32
+ "github_pat"
33
+ + "_11AAHPVFQ0qAkDnSUaMKSp"
34
+ + "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
33
35
  )
34
36
  PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
35
37
  GH_CLIENT = Github(auth=Auth.Token(PAT))
@@ -99,7 +101,6 @@ class BootloaderMethod(Enum):
99
101
  NONE = "none"
100
102
 
101
103
 
102
-
103
104
  @dataclass
104
105
  class FlashParams(Params):
105
106
  """Parameters for flashing a board"""
@@ -136,13 +137,20 @@ def filtered_comports(
136
137
 
137
138
  # remove ports that are to be ignored
138
139
  log.trace(f"{include=}, {ignore=}, {bluetooth=}")
139
- comports = [p for p in list_ports.comports() if not any(fnmatch.fnmatch(p.device, i) for i in ignore)]
140
+ # use p.location to filter out the bogus ports on newer Linux kernels
141
+ comports = [
142
+ p
143
+ for p in list_ports.comports()
144
+ if p.location and not any(fnmatch.fnmatch(p.device, i) for i in ignore)
145
+ ]
140
146
  log.trace(f"comports: {[p.device for p in comports]}")
141
147
  # remove bluetooth ports
142
148
 
143
149
  if include != ["*"]:
144
150
  # if there are explicit ports to include, add them to the list
145
- explicit = [p for p in list_ports.comports() if any(fnmatch.fnmatch(p.device, i) for i in include)]
151
+ explicit = [
152
+ p for p in list_ports.comports() if any(fnmatch.fnmatch(p.device, i) for i in include)
153
+ ]
146
154
  log.trace(f"explicit: {[p.device for p in explicit]}")
147
155
  if ignore == []:
148
156
  # if nothing to ignore, just use the explicit list as a sinple sane default
@@ -161,6 +169,9 @@ def filtered_comports(
161
169
  # sort
162
170
  if sys.platform == "win32":
163
171
  # Windows sort of comports by number - but fallback to device name
164
- return sorted(comports, key=lambda x: int(x.device.split()[0][3:]) if x.device.split()[0][3:].isdigit() else x)
172
+ return sorted(
173
+ comports,
174
+ key=lambda x: int(x.device.split()[0][3:]) if x.device.split()[0][3:].isdigit() else x,
175
+ )
165
176
  # sort by device name
166
177
  return sorted(comports, key=lambda x: x.device)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mpflash
3
- Version: 1.0.0
3
+ Version: 1.0.1
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
@@ -13,7 +13,7 @@ mpflash/cli_flash.py,sha256=U64IAqwTVeYubXTUO6UXY9SiS_e5NsQwyPYxf1juX8s,7166
13
13
  mpflash/cli_group.py,sha256=JFBtp4qhakJeQkuupEoObHeSFke8eWIU1HjnOZ-JfH0,2504
14
14
  mpflash/cli_list.py,sha256=51iLSehG9vWOvgeovJ8UYBjKkdnZStG1gAgYa0Cheog,2340
15
15
  mpflash/cli_main.py,sha256=cElgh8Soq3U5TEAvrrD1sj7NDi-Eb-pei3QcMI0tlwE,1094
16
- mpflash/common.py,sha256=O-Zb8ASNmEFmBD5JVgVtS1RyGUXJI2o4WH99dr6RMRg,5884
16
+ mpflash/common.py,sha256=P5Pt_Cjr6e5P8J5SB7Uhy6H-ARZSRTL2pApZ1rJOX_M,6067
17
17
  mpflash/config.py,sha256=h2Oq7kSe40tOnglpo02wkpaPHxHNVqyB3uGxreIu57U,1029
18
18
  mpflash/connected.py,sha256=LtyNWloEtEOKvmnTCSSNOADT0KeVbtjHpDQwu4dot2o,3053
19
19
  mpflash/download.py,sha256=mckR3pdMFQMYBKNmKBEJm9bJnTtQEnkuQ1vWYXcRRv8,13941
@@ -46,8 +46,8 @@ 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
48
  mpflash/versions.py,sha256=x5VrdVfWhZJfH7tZmwu2vVx-mPrK1iunYSpSce9VUXU,4492
49
- mpflash-1.0.0.dist-info/LICENSE,sha256=xHwgxGNkI0R2iN4KNfbPbQSzRomWyRz7bJnR1O2mln8,1057
50
- mpflash-1.0.0.dist-info/METADATA,sha256=-YRNUdXO5bC-3oFx9-82wpnP4WBeg3NXkX_HOfvUP30,17649
51
- mpflash-1.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
- mpflash-1.0.0.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
53
- mpflash-1.0.0.dist-info/RECORD,,
49
+ mpflash-1.0.1.dist-info/LICENSE,sha256=xHwgxGNkI0R2iN4KNfbPbQSzRomWyRz7bJnR1O2mln8,1057
50
+ mpflash-1.0.1.dist-info/METADATA,sha256=b5hg5kCyvR3IBzo03N7SiqzesIDbTMkV9QiIjbLbZVE,17649
51
+ mpflash-1.0.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
+ mpflash-1.0.1.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
53
+ mpflash-1.0.1.dist-info/RECORD,,