pydantic 模块的 Yocto 配方

Yocto recipe for pydantic module

我尝试在 Yocto 2.6 Thud

中包含来自 pypi.org 的 python modul 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"

依赖模块也包含在生成的配方中,并且编译正常。 无论如何,我在 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 中使用 Python f-strings,这是 Python 3.6 中引入的语法。因此,配方无法构建,因为 Yocto 的 Python 3.5 无法识别该语法,因此来自 Python 解释器的 SyntaxError 试图 运行 setup.py.

pydantic install guide 说:

pydantic has no required dependencies except python 3.6, 3.7, 3.8, or 3.9, typing-extensions, and the dataclasses backport package for python 3.6. If you've got python 3.6+ and pip installed, you're good to go.

要在 Yocto 中构建此包,您需要一个包含较新版本 Python 3 的版本 - 通常在 Yocto 的次要版本中更新。见下文:

Yocto Release Version of python3 recipe
thud (2.6) 3.5.6 (source), not supported by pydantic
warrior (2.7) 3.7.7 (source)
zeus (3.0) 3.7.8 (source)
dunfell (3.1) 3.8.11
gatesgarth (3.2) 3.8.5
hardknott (3.3) 3.9.5