diff options
author | Damien George <damien@micropython.org> | 2024-02-08 17:03:43 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-08 17:16:10 +1100 |
commit | 35dd959133fb233d75e9b3cddbf98b2ed01c6594 (patch) | |
tree | e1e37d95d5dfd9ad58086105445e7d2d78a20496 /docs/reference | |
parent | 2bdaa1bedede63ee2380aa5de67802cb5d2cfcd1 (diff) | |
download | micropython-35dd959133fb233d75e9b3cddbf98b2ed01c6594.tar.gz micropython-35dd959133fb233d75e9b3cddbf98b2ed01c6594.zip |
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>
Diffstat (limited to 'docs/reference')
-rw-r--r-- | docs/reference/manifest.rst | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/docs/reference/manifest.rst b/docs/reference/manifest.rst index 9bcafd5839..1a80b1259e 100644 --- a/docs/reference/manifest.rst +++ b/docs/reference/manifest.rst @@ -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) |