mpbuild 0.6__tar.gz → 0.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpbuild
3
- Version: 0.6
3
+ Version: 0.8
4
4
  Summary: Build MicroPython firmware with ease!
5
5
  Author-email: Matt Trentini <matt.trentini@gmail.com>
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mpbuild"
3
- version = "0.6"
3
+ version = "0.8"
4
4
  description = "Build MicroPython firmware with ease!"
5
5
  authors = [
6
6
  { name = "Matt Trentini", email = "matt.trentini@gmail.com" }
@@ -34,10 +34,10 @@ provides a way to browse it's data.
34
34
 
35
35
  from __future__ import annotations
36
36
 
37
- from pathlib import Path
38
37
  import json
39
38
  from dataclasses import dataclass, field
40
39
  from glob import glob
40
+ from pathlib import Path
41
41
 
42
42
 
43
43
  class MpbuildMpyDirectoryException(Exception):
@@ -110,7 +110,7 @@ class Board:
110
110
  board = Board(
111
111
  name=filename_json.parent.name,
112
112
  variants=[],
113
- url=board_json["url"],
113
+ url=board_json.get("url", "http://micropython.org"),
114
114
  mcu=board_json["mcu"],
115
115
  product=board_json["product"],
116
116
  vendor=board_json["vendor"],
@@ -159,6 +159,9 @@ class Board:
159
159
  for v in self.variants:
160
160
  if v.name == variant:
161
161
  return v
162
+ print(
163
+ f"Variant '{variant}' not found for board '{self.name}': Valid variants are: {[v.name for v in self.variants]}"
164
+ )
162
165
 
163
166
  return None
164
167
 
@@ -239,7 +242,6 @@ class Database:
239
242
  port = Port(
240
243
  name=special_port_name,
241
244
  directory=path,
242
- boards={special_port_name: board},
243
245
  )
244
246
  board = Board(
245
247
  name=special_port_name,
@@ -253,10 +255,8 @@ class Database:
253
255
  physical_board=False,
254
256
  port=port,
255
257
  )
256
- board.variants = [
257
- Variant(name=v, text="", board=board) for v in variant_names
258
- ]
259
-
258
+ port.boards = {special_port_name: board}
259
+ board.variants = [Variant(name=v, text="", board=board) for v in variant_names]
260
260
  self.ports[special_port_name] = port
261
261
  self.boards[board.name] = board
262
262
 
@@ -20,7 +20,7 @@ BUILD_CONTAINERS = {
20
20
  "mimxrt": ARM_BUILD_CONTAINER,
21
21
  "renesas-ra": ARM_BUILD_CONTAINER,
22
22
  "samd": ARM_BUILD_CONTAINER,
23
- "esp32": "espressif/idf",
23
+ "esp32": "espressif/idf:v5.2.2",
24
24
  "esp8266": "larsks/esp-open-sdk",
25
25
  "unix": "gcc:12-bookworm", # Special, doesn't have boards
26
26
  }
@@ -39,7 +39,7 @@ def get_build_container(board: Board, variant: Optional[str] = None) -> str:
39
39
  """
40
40
  port = board.port
41
41
 
42
- if board.name == "RPI_PICO2":
42
+ if port.name == "rp2":
43
43
  if variant == "RISCV":
44
44
  # Special case: This board supports an ARM core as default
45
45
  # and a RISC-V core as a variant
@@ -54,8 +54,6 @@ def get_build_container(board: Board, variant: Optional[str] = None) -> str:
54
54
  raise MpbuildNotSupportedException(f"{board.name}-{variant}") from e
55
55
 
56
56
 
57
- IDF_DEFAULT = "v5.2.2"
58
-
59
57
  nprocs = multiprocessing.cpu_count()
60
58
 
61
59
 
@@ -65,7 +63,6 @@ def docker_build_cmd(
65
63
  extra_args: List[str] = [],
66
64
  do_clean: bool = False,
67
65
  build_container_override: str | None = None,
68
- idf: str = IDF_DEFAULT,
69
66
  docker_interactive: bool = True,
70
67
  ) -> str:
71
68
  """
@@ -87,20 +84,13 @@ def docker_build_cmd(
87
84
  else get_build_container(board=board, variant=variant)
88
85
  )
89
86
 
90
- if port.name == "esp32" and not build_container_override:
91
- if not idf:
92
- idf = IDF_DEFAULT
93
- build_container += f":{idf}"
94
-
95
87
  variant_param = "BOARD_VARIANT" if board.physical_board else "VARIANT"
96
88
  variant_cmd = "" if variant is None else f" {variant_param}={variant}"
97
89
 
98
90
  args = " " + " ".join(extra_args)
99
91
 
100
92
  make_mpy_cross_cmd = "make -C mpy-cross && "
101
- update_submodules_cmd = (
102
- f"make -C ports/{port.name} submodules BOARD={board.name}{variant_cmd} && "
103
- )
93
+ update_submodules_cmd = f"make -C ports/{port.name} submodules && "
104
94
 
105
95
  uid, gid = os.getuid(), os.getgid()
106
96
 
@@ -141,7 +131,6 @@ def build_board(
141
131
  variant: Optional[str] = None,
142
132
  extra_args: List[str] = [],
143
133
  build_container_override: Optional[str] = None,
144
- idf: Optional[str] = IDF_DEFAULT,
145
134
  mpy_dir: str | Path | None = None,
146
135
  ) -> None:
147
136
  """
@@ -170,10 +159,6 @@ def build_board(
170
159
  print(f"Sorry, builds are not supported for the {port} port at this time")
171
160
  raise SystemExit()
172
161
 
173
- if port != "esp32" and idf != IDF_DEFAULT:
174
- print("An IDF version can only be specified for ESP32 builds")
175
- raise SystemExit()
176
-
177
162
  do_clean = bool(extra_args and extra_args[0].strip() == "clean")
178
163
  build_cmd = docker_build_cmd(
179
164
  board=_board,
@@ -181,7 +166,6 @@ def build_board(
181
166
  extra_args=extra_args,
182
167
  do_clean=do_clean,
183
168
  build_container_override=build_container_override,
184
- idf=idf,
185
169
  )
186
170
 
187
171
  title = "Build" if do_clean else "Clean"
@@ -209,13 +193,11 @@ def build_board(
209
193
  def clean_board(
210
194
  board: str,
211
195
  variant: Optional[str] = None,
212
- idf: Optional[str] = IDF_DEFAULT,
213
196
  mpy_dir: Optional[str] = None,
214
197
  ) -> None:
215
198
  build_board(
216
199
  board=board,
217
200
  variant=variant,
218
201
  mpy_dir=mpy_dir,
219
- idf=idf,
220
202
  extra_args=["clean"],
221
203
  )
@@ -4,7 +4,7 @@ from typing_extensions import Annotated
4
4
  import typer
5
5
 
6
6
  from . import __app_name__, __version__, OutputFormat
7
- from .build import build_board, clean_board, IDF_DEFAULT
7
+ from .build import build_board, clean_board
8
8
  from .list_boards import print_boards
9
9
  from .check_images import check_images
10
10
  from .completions import list_ports, list_boards, list_variants_for_board
@@ -42,10 +42,6 @@ def build(
42
42
  Optional[str],
43
43
  typer.Argument(help="Board variant", autocompletion=_complete_variant),
44
44
  ] = None,
45
- idf: Annotated[
46
- Optional[str],
47
- typer.Option(help="esp32 port only: select IDF version to build with"),
48
- ] = IDF_DEFAULT,
49
45
  extra_args: Annotated[
50
46
  Optional[List[str]], typer.Argument(help="additional arguments to pass to make")
51
47
  ] = None,
@@ -57,7 +53,9 @@ def build(
57
53
  """
58
54
  Build a MicroPython board.
59
55
  """
60
- build_board(board, variant, extra_args or [], build_container, idf)
56
+ if variant == "":
57
+ variant = None
58
+ build_board(board, variant, extra_args or [], build_container)
61
59
 
62
60
 
63
61
  @app.command()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes