tools/manifestfile.py: Change library search to use a list of paths.
This commit changes how library packages are searched for when a manifest
file is loaded: there is now simply a list of library paths that is
searched in order for the given package. This list defaults to the
main directories in micropython-lib, but can be added to -- either appended
or prepended -- by using `add_library()`.
In particular the way unix-ffi library packages are searched has changed,
because the `unix_ffi` argument to `require()` is now removed. Instead, if
a build wants to include packages from micropython-lib/unix-ffi, then it
must explicitly add this to the list of paths to search using:
add_library("unix-ffi", "$(MPY_LIB_DIR)/unix-ffi")
Work done in collaboration with Jim Mussared.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -95,6 +95,17 @@ Note: The ``opt`` keyword argument can be set on the various functions, this con
|
||||
the optimisation level used by the cross-compiler.
|
||||
See :func:`micropython.opt_level`.
|
||||
|
||||
.. function:: add_library(library, library_path, prepend=False)
|
||||
|
||||
Register the path to an external named *library*.
|
||||
|
||||
The path *library_path* will be automatically searched when using `require`.
|
||||
By default the added library is added to the end of the list of libraries to
|
||||
search. Pass ``True`` to *prepend* to add it to the start of the list.
|
||||
|
||||
Additionally, the added library can be explicitly requested by using
|
||||
``require("name", library="library")``.
|
||||
|
||||
.. function:: package(package_path, files=None, base_path=".", opt=None)
|
||||
|
||||
This is equivalent to copying the "package_path" directory to the device
|
||||
@@ -138,11 +149,13 @@ See :func:`micropython.opt_level`.
|
||||
|
||||
You can use the variables above, such as ``$(PORT_DIR)`` in ``base_path``.
|
||||
|
||||
.. function:: require(name, unix_ffi=False)
|
||||
.. function:: require(name, library=None)
|
||||
|
||||
Require a package by name (and its dependencies) from :term:`micropython-lib`.
|
||||
|
||||
Optionally specify unix_ffi=True to use a module from the unix-ffi directory.
|
||||
Optionally specify *library* (a string) to reference a package from a
|
||||
library that has been previously registered with `add_library`. Otherwise
|
||||
the list of library paths will be used.
|
||||
|
||||
.. function:: include(manifest_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user