mirror of
https://github.com/openwrt/packages.git
synced 2025-12-20 01:21:21 +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>
(cherry picked from commit 9390bd0262)
This commit is contained in:
@@ -12,42 +12,125 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/micropython/micropython-lib.git
|
||||
PKG_SOURCE_VERSION:=db4c739863e49fc874bdaae8aa8c316c7ed4276a
|
||||
PKG_SOURCE_DATE:=20220506
|
||||
PKG_MIRROR_HASH:=ec4be91755fcd4d4fa61e1e7eadc748377ba63b82b7bb4254864473fafcd3173
|
||||
PKG_SOURCE_VERSION:=7128d423c2e7c0309ac17a1e6ba873b909b24fcc
|
||||
PKG_SOURCE_DATE:=20230522
|
||||
PKG_MIRROR_HASH:=1f094aac257d2094ee91b457164f845f6461df1cf1d0ed7ee556c98f273f5afb
|
||||
|
||||
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
|
||||
PKG_LICENSE:=MIT PSF-2.0
|
||||
PKG_LICENSE:=MIT Python-2.0.1
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=python3/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
# keep in sync with micropython
|
||||
MP_VERSION:=1.20.0
|
||||
MP_MPY_FILE_VERSION:=6
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/micropython-lib
|
||||
define Package/micropython-lib/Default
|
||||
SUBMENU:=Python
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=micropython-lib
|
||||
TITLE:=MicroPython package repository
|
||||
URL:=https://github.com/micropython/micropython-lib
|
||||
endef
|
||||
|
||||
define Package/micropython-lib
|
||||
$(call Package/micropython-lib/Default)
|
||||
DEPENDS:=+micropython
|
||||
endef
|
||||
|
||||
define Package/micropython-lib/description
|
||||
This is a repository of libraries designed to be useful for writing
|
||||
MicroPython applications.
|
||||
define Package/micropython-lib-src
|
||||
$(call Package/micropython-lib/Default)
|
||||
TITLE+= (sources)
|
||||
endef
|
||||
|
||||
Build/Compile:=:
|
||||
define Package/micropython-lib-unix
|
||||
$(call Package/micropython-lib/Default)
|
||||
TITLE+= - Unix port packages
|
||||
DEPENDS:=+micropython +libpcre +librt +libsqlite3
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-unix-src
|
||||
$(call Package/micropython-lib/Default)
|
||||
TITLE+= - Unix port packages (sources)
|
||||
endef
|
||||
|
||||
define Package/micropython-lib/Default/description
|
||||
This is a repository of packages designed to be useful for writing
|
||||
MicroPython applications.
|
||||
endef
|
||||
|
||||
define Package/micropython-lib/description
|
||||
$(call Package/micropython-lib/Default/description)
|
||||
|
||||
This contains packages common to all MicroPython ports.
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-src/description
|
||||
$(call Package/micropython-lib/Default/description)
|
||||
|
||||
This contains source files for packages common to all MicroPython ports.
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-unix/description
|
||||
$(call Package/micropython-lib/Default/description)
|
||||
|
||||
This contains packages specific to the MicroPython Unix port.
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-unix-src/description
|
||||
$(call Package/micropython-lib/Default/description)
|
||||
|
||||
This contains source files for packages specific to the MicroPython Unix
|
||||
port.
|
||||
endef
|
||||
|
||||
MP_INSTALLDEV_PATH:=$(STAGING_DIR)/host/lib/micropython-$(MP_VERSION)
|
||||
|
||||
define MicroPythonLib/Compile
|
||||
cd "$(PKG_BUILD_DIR)" && python3 tools/build.py \
|
||||
--hash-prefix 64 \
|
||||
--micropython "$(MP_INSTALLDEV_PATH)" \
|
||||
--mpy-cross "$(MP_INSTALLDEV_PATH)/mpy-cross/build/mpy-cross" \
|
||||
--output "$(PKG_BUILD_DIR)/$(strip $(1))" \
|
||||
$(2)
|
||||
endef
|
||||
|
||||
define MicroPythonLib/Install
|
||||
python3 install.py \
|
||||
--input "$(PKG_BUILD_DIR)/$(strip $(1))" \
|
||||
--output "$(strip $(3))" \
|
||||
--version "$(strip $(2))"
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call MicroPythonLib/Compile)
|
||||
$(call MicroPythonLib/Compile,unix-ffi-index,--unix-ffi)
|
||||
endef
|
||||
|
||||
define Package/micropython-lib/install
|
||||
for dir in micropython python-ecosys python-stdlib unix-ffi; do \
|
||||
$(INSTALL_DIR) $(1)/usr/lib/micropython/$$$$dir ; \
|
||||
$(CP) $(PKG_BUILD_DIR)/$$$$dir/* $(1)/usr/lib/micropython/$$$$dir/ ; \
|
||||
done
|
||||
$(FIND) $(1)/usr/lib/micropython \
|
||||
-not -type d \( -not -name '*.py' -o -name 'test_*' -o -name 'setup.py' \) -delete
|
||||
$(FIND) $(1)/usr/lib/micropython -mindepth 1 -empty -type d -delete
|
||||
$(call MicroPythonLib/Install,,$(MP_MPY_FILE_VERSION),$(1)/usr/lib/micropython)
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-src/install
|
||||
$(call MicroPythonLib/Install,,py,$(1)/usr/lib/micropython)
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-unix/install
|
||||
$(call MicroPythonLib/Install,unix-ffi-index,$(MP_MPY_FILE_VERSION),$(1)/usr/lib/micropython/unix)
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) ./files/micropython-unix $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/micropython-lib-unix-src/install
|
||||
$(call MicroPythonLib/Install,unix-ffi-index,py,$(1)/usr/lib/micropython/unix)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,micropython-lib))
|
||||
$(eval $(call BuildPackage,micropython-lib-src))
|
||||
$(eval $(call BuildPackage,micropython-lib-unix))
|
||||
$(eval $(call BuildPackage,micropython-lib-unix-src))
|
||||
|
||||
Reference in New Issue
Block a user