我尝试在Yocto 2.6 Thud中包含来自pypi.org的python模块pydantic与下一个配方(由https://github.com/NFJones/pipoe自动生成)
SUMMARY = "Data validation and settings management using python 3.6 type hinting"
HOMEPAGE = "https://github.com/samuelcolvin/pydantic"
AUTHOR = "Samuel Colvin <s@muelcolvin.com>"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2c02ea30650b91528657db64baea1757"
inherit setuptools3
SRC_URI = "https://files.pythonhosted.org/packages/b9/d2/12a808613937a6b98cd50d6467352f01322dc0d8ca9fb5b94441625d6684/pydantic-1.8.2.tar.gz"
SRC_URI[md5sum] = "7845d2f3c8fe8602f73f53ec5b6dfa29"
SRC_URI[sha256sum] = "26464e57ccaafe72b7ad156fdaa4e9b9ef051f69e175dbbb463283000c05ab7b"
S = "${WORKDIR}/pydantic-1.8.2"
DEPENDS += " "
RDEPENDS_${PN} = "python3-typing-extensions"
BBCLASSEXTEND = "native nativesdk"
dependencies模块也包含在生成的recipe中,并且编译成功。无论如何,我在bitbake过程中收到错误,无法避免:
Log data follows:
| DEBUG: Executing shell function do_configure
| File "setup.py", line 47
| self.links.add(f'.. _#{id}: https://github.com/samuelcolvin/pydantic/issues/{id}')
| ^
| SyntaxError: invalid syntax
| WARNING: exit code 1 from a shell command.
有什么想法吗(不需要伪造和编辑源代码)?
Yocto 2.6 Thud中的python3
配方是Python 3.5.6版本。
然而,pydantic
PyPI包在其setup.py中使用Pythonf-strings
,该语法在Python 3.6中引入。因此,配方无法构建,因为Yocto的Python 3.5不识别该语法,因此Python解释器中的SyntaxError
试图运行setup.py
。
pydantic
安装指南说:
pydantic除了python 3.6, 3.7, 3.8或3.9,类型扩展和python 3.6的数据类后端口包之外,没有必要的依赖项。如果你已经安装了python 3.6+和pip,你就可以开始了。
要在Yocto中构建此包,您需要一个包含较新版本Python 3的发行版-通常在Yocto的次要版本中更新。见下文:
Yocto发布 | python3 配方版本 |
砰(2.6) | 3.5.6(源),不支持的pydantic |
---|---|
战士(2.7) | 3.7.7(源) |
3.7.8(源) | |
dunfell (3.1) | 3.8.11 |
gatesgarth (3.2) | 3.8.5 |
hardknott (3.3) | 3.9.5 |