mirror of
https://github.com/openwrt/packages.git
synced 2025-12-18 00:21:22 +00:00
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>
This commit is contained in:
37
lang/python/micropython-lib/patches/001-build-unix-ffi.patch
Normal file
37
lang/python/micropython-lib/patches/001-build-unix-ffi.patch
Normal file
@@ -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__":
|
||||
@@ -0,0 +1,53 @@
|
||||
From dcce62dd525cf0f8e572e56a8990aea7ec2f0ade Mon Sep 17 00:00:00 2001
|
||||
From: Jeffery To <jeffery.to@gmail.com>
|
||||
Date: Tue, 30 May 2023 23:47:59 +0800
|
||||
Subject: [PATCH] unix-ffi/os-path: Add unix-ffi version of `os-path` package.
|
||||
|
||||
This package reuses the code from the python-stdlib version of `os-path`
|
||||
but requires the unix-ffi version of `os`.
|
||||
|
||||
This also updates `glob` to require this version of `os-path`.
|
||||
|
||||
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
|
||||
---
|
||||
unix-ffi/glob/manifest.py | 2 +-
|
||||
unix-ffi/os-path/manifest.py | 6 ++++++
|
||||
unix-ffi/os/os/__init__.py | 6 ++++++
|
||||
3 files changed, 13 insertions(+), 1 deletion(-)
|
||||
create mode 100644 unix-ffi/os-path/manifest.py
|
||||
|
||||
--- a/unix-ffi/glob/manifest.py
|
||||
+++ b/unix-ffi/glob/manifest.py
|
||||
@@ -1,7 +1,7 @@
|
||||
metadata(version="0.5.2")
|
||||
|
||||
require("os", unix_ffi=True)
|
||||
-require("os-path")
|
||||
+require("os-path", unix_ffi=True)
|
||||
require("re", unix_ffi=True)
|
||||
require("fnmatch")
|
||||
|
||||
--- /dev/null
|
||||
+++ b/unix-ffi/os-path/manifest.py
|
||||
@@ -0,0 +1,6 @@
|
||||
+metadata(version="0.1.4")
|
||||
+
|
||||
+# Originally written by Paul Sokolovsky.
|
||||
+
|
||||
+require("os", unix_ffi=True)
|
||||
+package("os", base_path="../../python-stdlib/os-path")
|
||||
--- a/unix-ffi/os/os/__init__.py
|
||||
+++ b/unix-ffi/os/os/__init__.py
|
||||
@@ -5,6 +5,12 @@ import stat as stat_
|
||||
import ffilib
|
||||
import uos
|
||||
|
||||
+# Provide optional dependencies (which may be installed separately).
|
||||
+try:
|
||||
+ from . import path
|
||||
+except ImportError:
|
||||
+ pass
|
||||
+
|
||||
R_OK = const(4)
|
||||
W_OK = const(2)
|
||||
X_OK = const(1)
|
||||
@@ -0,0 +1,37 @@
|
||||
From 2e7bfd08a306bd9e80b22097ef8fe66e1dd85054 Mon Sep 17 00:00:00 2001
|
||||
From: Jeffery To <jeffery.to@gmail.com>
|
||||
Date: Wed, 31 May 2023 00:00:11 +0800
|
||||
Subject: [PATCH] unix-ffi/uu: Add unix-ffi version of `uu` package.
|
||||
|
||||
This package reuses the code from the python-stdlib version of `uu` but
|
||||
requires the unix-ffi version of `os-path`.
|
||||
|
||||
This also updates `email.message` to require this version of `uu`.
|
||||
|
||||
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
|
||||
---
|
||||
unix-ffi/email.message/manifest.py | 2 +-
|
||||
unix-ffi/uu/manifest.py | 6 ++++++
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
create mode 100644 unix-ffi/uu/manifest.py
|
||||
|
||||
--- a/unix-ffi/email.message/manifest.py
|
||||
+++ b/unix-ffi/email.message/manifest.py
|
||||
@@ -1,7 +1,7 @@
|
||||
metadata(version="0.5.3")
|
||||
|
||||
require("re", unix_ffi=True)
|
||||
-require("uu")
|
||||
+require("uu", unix_ffi=True)
|
||||
require("base64")
|
||||
require("binascii")
|
||||
require("email.utils", unix_ffi=True)
|
||||
--- /dev/null
|
||||
+++ b/unix-ffi/uu/manifest.py
|
||||
@@ -0,0 +1,6 @@
|
||||
+metadata(version="0.5.1")
|
||||
+
|
||||
+require("binascii")
|
||||
+require("os-path", unix_ffi=True)
|
||||
+
|
||||
+module("uu.py", base_path="../../python-stdlib/uu")
|
||||
Reference in New Issue
Block a user