I try to include python modul pydantic from pypi.org with next recipe (generated auto by https://github.com/NFJones/pipoe ) in Yocto 2.6 Thud
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"
Depended module is also included with generated recipe and it's compiled OK. Anyway I've receive error during bitbake and can't avoid it:
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.
Any ideas (without forge and edit the source) ?
The python3
recipe in Yocto 2.6 Thud, is version Python 3.5.6.
However, pydantic
PyPI package uses Python f-strings
in its setup.py, which is syntax introduced in Python 3.6. Therefore, the recipe fails to build because Yocto's Python 3.5 does not recognise that syntax, hence the SyntaxError
from the Python interpreter trying to run setup.py
.
The pydantic
install guide says:
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.
To build this package within Yocto, you'll need a release that includes a newer version of Python 3 - which is typically updated in Yocto's minor point releases. See below: