packages/lang/python/micropython-lib/Makefile

52 lines
1.3 KiB
Makefile
Raw Normal View History

#
2015-07-03 16:54:20 +00:00
# Copyright (C) 2008-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=micropython-lib
PKG_VERSION:=1.9.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/micropython/micropython-lib/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=66e15380eb109613263beb6825b8eecb9191088270c1a59e8c7d922dd57183c7
PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
PKG_LICENSE:=MIT, PSFL
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/micropython-lib
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
TITLE:=micropython-lib
URL:=https://github.com/micropython/micropython-lib
DEPENDS:=+micropython
endef
define Package/micropython-lib/description
This package contains micropython-lib, a project to develop a non-monolothic
standard library for Micro Python. Note that this is a work in progress and
several libraries may be missing, incomplete or buggy.
endef
MAKE_FLAGS:=\
micropython-lib: workaround the `install` build rule So, I chose to workaround it in the Makefile. A proper fix is a bit more work that I would like to do now, and I have no suggestion/idea for a good fix right now. The problem is with the `CMD` part that's used in the install rule, together with the fact that PREFIX is the same as the source location. ``` CMD="find . -maxdepth 1 -mindepth 1 \( -name '*.py' -not -name 'test_*' -not -name 'setup.py' \) -or \( -type d -not -name 'dist' -not -name '*.egg-info' -not -name '__pycache__' \)| xargs --no-run-if-empty cp -r -t $(PREFIX)" ``` The gist of it, is that it seems that this will filter and copy to `PREFIX` all python sources and folders that are not names `dist`, `__pycache__`, or `*.egg-info`. And it searches all folders at (exactly) depth 1. The solution I chose is to put a `dist` folder under `_install_tmp`, which is kind of a trick to go to depth 2 and avoid both conditions in the `find` call. This avoids errors: ``` cp: './weakref.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/weakref.py' are the same file cp: './xmltok.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/xmltok.py' are the same file cp: './zipfile.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/zipfile.py' are the same file ``` Initially I tried to add exit 0, but that would just hide other (potentially worse) issues. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-01-17 13:02:23 +00:00
PREFIX=$(PKG_BUILD_DIR)/_install_tmp/dist \
install
define Package/micropython-lib/install
$(INSTALL_DIR) $(1)/usr/lib/micropython
micropython-lib: workaround the `install` build rule So, I chose to workaround it in the Makefile. A proper fix is a bit more work that I would like to do now, and I have no suggestion/idea for a good fix right now. The problem is with the `CMD` part that's used in the install rule, together with the fact that PREFIX is the same as the source location. ``` CMD="find . -maxdepth 1 -mindepth 1 \( -name '*.py' -not -name 'test_*' -not -name 'setup.py' \) -or \( -type d -not -name 'dist' -not -name '*.egg-info' -not -name '__pycache__' \)| xargs --no-run-if-empty cp -r -t $(PREFIX)" ``` The gist of it, is that it seems that this will filter and copy to `PREFIX` all python sources and folders that are not names `dist`, `__pycache__`, or `*.egg-info`. And it searches all folders at (exactly) depth 1. The solution I chose is to put a `dist` folder under `_install_tmp`, which is kind of a trick to go to depth 2 and avoid both conditions in the `find` call. This avoids errors: ``` cp: './weakref.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/weakref.py' are the same file cp: './xmltok.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/xmltok.py' are the same file cp: './zipfile.py' and '/home/sandu/work/lede/build_dir/target-mips_24kc_musl-1.1.16/micropython-lib-1.8.6-f81e979c56dddb771ad36ec381b7f2c6cd12111f-f81e979c56dddb771ad36ec381b7f2c6cd12111f/_install_tmp/zipfile.py' are the same file ``` Initially I tried to add exit 0, but that would just hide other (potentially worse) issues. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2017-01-17 13:02:23 +00:00
$(CP) $(PKG_BUILD_DIR)/_install_tmp/dist/* $(1)/usr/lib/micropython
endef
$(eval $(call BuildPackage,micropython-lib))