kopia lustrzana https://github.com/micropython/micropython
tools/makemanifest.py: Provide access to MICROPY_MANIFEST_xxx symbols.
The new function resolve(name) returns the value of a Makefile symbol defined as MICROPY_MANIFEST_<name>. Example: Makefile: MICROPY_MANIFEST_FROZEN_SET = "default" manifest.py: frozen_set = resolve("$FROZEN_SET") If name is not defined, resolve() returns `None`. Set the symbols MICROPY_MANIFEST_BOARD and MICROPY_MANIFEST_BOARD_VARIANT by default. Notes: - Instead of "resolve" the function may have any other appropriate name. - The "$XYZ" notation was kept for consistency with the other functions. Signed-off-by: robert-hh <robert@hammelrath.com>pull/13243/head
rodzic
b3c62f3169
commit
4df350fd3c
|
@ -206,6 +206,9 @@ MICROPY_MANIFEST_MPY_LIB_DIR = $(MPY_LIB_DIR)
|
||||||
MICROPY_MANIFEST_PORT_DIR = $(shell pwd)
|
MICROPY_MANIFEST_PORT_DIR = $(shell pwd)
|
||||||
MICROPY_MANIFEST_BOARD_DIR = $(BOARD_DIR)
|
MICROPY_MANIFEST_BOARD_DIR = $(BOARD_DIR)
|
||||||
MICROPY_MANIFEST_MPY_DIR = $(TOP)
|
MICROPY_MANIFEST_MPY_DIR = $(TOP)
|
||||||
|
# Set variables for BOARD and BOARD_VARIANT by default
|
||||||
|
MICROPY_MANIFEST_BOARD = $(BOARD)
|
||||||
|
MICROPY_MANIFEST_BOARD_VARIANT = $(BOARD_VARIANT)
|
||||||
|
|
||||||
# Find all MICROPY_MANIFEST_* variables and turn them into command line arguments.
|
# Find all MICROPY_MANIFEST_* variables and turn them into command line arguments.
|
||||||
MANIFEST_VARIABLES = $(foreach var,$(filter MICROPY_MANIFEST_%, $(.VARIABLES)),-v "$(subst MICROPY_MANIFEST_,,$(var))=$($(var))")
|
MANIFEST_VARIABLES = $(foreach var,$(filter MICROPY_MANIFEST_%, $(.VARIABLES)),-v "$(subst MICROPY_MANIFEST_,,$(var))=$($(var))")
|
||||||
|
|
|
@ -222,6 +222,7 @@ class ManifestFile:
|
||||||
"add_library": self.add_library,
|
"add_library": self.add_library,
|
||||||
"package": self.package,
|
"package": self.package,
|
||||||
"module": self.module,
|
"module": self.module,
|
||||||
|
"resolve": self.resolve,
|
||||||
"options": IncludeOptions(**kwargs),
|
"options": IncludeOptions(**kwargs),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +573,12 @@ class ManifestFile:
|
||||||
"""
|
"""
|
||||||
self._freeze_internal(path, script, exts=(".mpy",), kind=KIND_FREEZE_MPY, opt=opt)
|
self._freeze_internal(path, script, exts=(".mpy",), kind=KIND_FREEZE_MPY, opt=opt)
|
||||||
|
|
||||||
|
def resolve(self, name):
|
||||||
|
if name[0] == "$" and name[1:] in self._path_vars.keys():
|
||||||
|
return self._path_vars[name[1:]]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
# Generate a temporary file with a line appended to the end that adds __version__.
|
# Generate a temporary file with a line appended to the end that adds __version__.
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
Ładowanie…
Reference in New Issue