首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python backports的openWRT生成文件

python backports的openWRT生成文件
EN

Stack Overflow用户
提问于 2017-11-29 09:15:38
回答 2查看 266关注 0票数 0

我正在尝试将backports-abc python模块构建到我的OpenWRT构建中,并且在构建/提取过程中需要一些帮助。

我的问题似乎是,由于底层的tar文件结构,下载的backports-abc tar文件将内容提取到backports_abc-0.5,但构建过程在backports-abc-0.5下查找setup.py等(见下文)。我可以手动复制文件并重新构建,这很好用,但这并不理想。此外,尽管它构建正常,但当我将映像加载到设备时,后端端口模块丢失。

代码语言:javascript
复制
/home/ubuntu/build2/openwrt/staging_dir/host/bin/python2: can't open file './setup.py': [Errno 2] No such file or directory
Makefile:59: recipe for target '/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built' failed
make[3]: *** [/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built] Error 2
make[3]: Leaving directory '/home/ubuntu/build2/openwrt/feeds/linkit/python-backports-abc

关于Makefiles的openWRT文档有点模糊,我对这个过程的理解也是如此。

如何将tar文件解压到正确的文件夹,或者在Makefile过程中的什么位置,我应该只将文件复制到正确的文件夹?

这是我的Makefile。

代码语言:javascript
复制
include $(TOPDIR)/rules.mk

PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/

#PKG_BUILD_DEPENDS:=python-setuptools

include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)

define Package/backports_abc
        SECTION:=lang-python
        CATEGORY:=Languages
        SUBMENU:=Python
        TITLE:=backports_abc
        URL:=https://pypi.python.org/pypi/backports_abc/0.5
        DEPENDS:=+python
endef

define Package/backports_abc/description
        A backport of recent additions to the 'collections.abc' module.
endef

define Build/Compile
        $(call Build/Compile/PyMod,., \
                install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
        )
endef

define Build/InstallDev
        $(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
        $(CP) \
                $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
                $(STAGING_DIR)$(PYTHON_PKG_DIR)/
        [ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
                $(PKG_INSTALL_DIR)/usr/include/* \
                $(STAGING_DIR)/usr/include/
endef

define Package/backportsabc/install
        $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
        $(CP) \
                $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
                $(1)$(PYTHON_PKG_DIR)/
endef

$(eval $(call BuildPackage,backports_abc))
EN

回答 2

Stack Overflow用户

发布于 2017-12-04 03:05:18

将Makefile复制到包目录中的某个位置,并从Makefile中删除PKG_BUILD_DIR变量以解决此问题。

票数 0
EN

Stack Overflow用户

发布于 2017-12-04 12:55:22

我通过设置一些下划线和连字符解决了这个问题...例如: backports_abc和backports-abc基本上..这..。PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/表示它正在根据PKG_NAME变量查找文件。

代码语言:javascript
复制
include $(TOPDIR)/rules.mk

PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/

#PKG_BUILD_DEPENDS:=python-setuptools 

include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)

define Package/backports-abc
    SECTION:=lang-python
    CATEGORY:=Languages
    SUBMENU:=Python
    TITLE:=backports-abc
    URL:=https://pypi.python.org/pypi/backports_abc/0.5
    DEPENDS:=+python
endef

define Package/backports-abc/description
    A backport of recent additions to the 'collections.abc' module.
endef

define Build/Compile
    $(call Build/Compile/PyMod,., \
        install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
    )
endef

define Build/InstallDev
    $(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
    $(CP) \
        $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
        $(STAGING_DIR)$(PYTHON_PKG_DIR)/
    [ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
        $(PKG_INSTALL_DIR)/usr/include/* \
        $(STAGING_DIR)/usr/include/
endef

define Package/backports-abc/install
    $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
    $(CP) \
        $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
        $(1)$(PYTHON_PKG_DIR)/
endef

$(eval $(call BuildPackage,backports-abc))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47543526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档