aboutsummaryrefslogtreecommitdiff
path: root/lang/python/micropython-lib/patches/001-build-unix-ffi.patch
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2023-05-30 03:24:54 +0800
committerJeffery To <jeffery.to@gmail.com>2023-06-02 21:39:58 +0800
commit9390bd0262ad9f0775b76984d1c8f29b9a35584e (patch)
tree138b1e3a2e246b38e2d89abfbe209b79735790a9 /lang/python/micropython-lib/patches/001-build-unix-ffi.patch
parenta4ae38494f0c12799b343eb521ca13123c0bb4e3 (diff)
micropython-lib: Update to master, split target package
The package has been reworked to install the same files that are available to be downloaded/installed by mip, the package manager new to MicroPython 1.20.0. This also splits the original target package into four: * micropython-lib * Includes packages common to all MicroPython ports (python-stdlib, python-ecosys, micropython) * Contains mpy bytecode files * micropython-lib-src * Includes packages common to all MicroPython ports (python-stdlib, python-ecosys, micropython) * Contains py source files * micropython-lib-unix * Includes packages specific to the MicroPython Unix port (unix-ffi) * Contains mpy bytecode files * Installs a specific launcher (micropython-unix) that adds the Unix package directory into MicroPython's library path * micropython-lib-unix-src * Includes packages specific to the MicroPython Unix port (unix-ffi) * Contains py source files This also updates the package license, title, and description. Patches: * 001-build-unix-ffi.patch This enables the repo build script to also build the Unix-specific packages. Not sure if upstream is open to accepting this since the Unix-specific packages don't fit well into the existing package distribution mechanism. * 002-add-unix-ffi-os-path.patch and 003-add-unix-ffi-uu.patch These fix instances where the unix-ffi version of the os package is overridden by the python-stdlib version. These have been submitted to upstream: https://github.com/micropython/micropython-lib/pull/672 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'lang/python/micropython-lib/patches/001-build-unix-ffi.patch')
-rw-r--r--lang/python/micropython-lib/patches/001-build-unix-ffi.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/lang/python/micropython-lib/patches/001-build-unix-ffi.patch b/lang/python/micropython-lib/patches/001-build-unix-ffi.patch
new file mode 100644
index 000000000..4dfaca6f9
--- /dev/null
+++ b/lang/python/micropython-lib/patches/001-build-unix-ffi.patch
@@ -0,0 +1,37 @@
+--- a/tools/build.py
++++ b/tools/build.py
+@@ -284,7 +284,7 @@ def _update_index_package_metadata(index
+ index_package_json["versions"][v].append(metadata.version)
+
+
+-def build(output_path, hash_prefix_len, mpy_cross_path):
++def build(output_path, unix_ffi, hash_prefix_len, mpy_cross_path):
+ import manifestfile
+ import mpy_cross
+
+@@ -310,7 +310,7 @@ def build(output_path, hash_prefix_len,
+
+ # For now, don't process unix-ffi. In the future this can be extended to
+ # allow a way to request unix-ffi packages via mip.
+- lib_dirs = ["micropython", "python-stdlib", "python-ecosys"]
++ lib_dirs = ["unix-ffi"] if unix_ffi else ["micropython", "python-stdlib", "python-ecosys"]
+
+ mpy_version, _mpy_sub_version = mpy_cross.mpy_version(mpy_cross=mpy_cross_path)
+ mpy_version = str(mpy_version)
+@@ -438,6 +438,7 @@ def main():
+
+ cmd_parser = argparse.ArgumentParser(description="Compile micropython-lib for serving to mip.")
+ cmd_parser.add_argument("--output", required=True, help="output directory")
++ cmd_parser.add_argument("--unix-ffi", action="store_true", help="process unix-ffi packages")
+ cmd_parser.add_argument("--hash-prefix", default=8, type=int, help="hash prefix length")
+ cmd_parser.add_argument("--mpy-cross", default=None, help="optional path to mpy-cross binary")
+ cmd_parser.add_argument("--micropython", default=None, help="path to micropython repo")
+@@ -447,7 +448,7 @@ def main():
+ sys.path.append(os.path.join(args.micropython, "tools")) # for manifestfile
+ sys.path.append(os.path.join(args.micropython, "mpy-cross")) # for mpy_cross
+
+- build(args.output, hash_prefix_len=max(4, args.hash_prefix), mpy_cross_path=args.mpy_cross)
++ build(args.output, args.unix_ffi, hash_prefix_len=max(4, args.hash_prefix), mpy_cross_path=args.mpy_cross)
+
+
+ if __name__ == "__main__":