【问题标题】:Yocto recipe for pydantic modulepydantic 模块的 Yocto 配方
【发布时间】:2021-09-03 08:53:31
【问题描述】:

我尝试在 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.

任何想法(无需伪造和编辑源代码)?

【问题讨论】:

    标签: python-3.x yocto pydantic


    【解决方案1】:

    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

    pydanticinstall guide 说:

    pydantic 没有必需的依赖项,除了 python 3.6、3.7、3.8 或 3.9、类型扩展和 python 3.6 的数据类反向移植包。如果你已经安装了 python 3.6+ 和 pip,你就可以开始了。

    要在 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

    【讨论】:

    • 我知道 Python 中的 f 格式会出现错误,但在 Thud 中认为至少是 Python 3.6.x 将尝试升级到 Warrior,但我担心这可能会导致更大的混乱......谢谢回复@贾斯汀
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-10
    • 2020-06-08
    • 2018-06-20
    • 1970-01-01
    • 2017-07-18
    • 2020-03-16
    • 2021-10-20
    相关资源
    最近更新 更多