Files
meta-openembedded/meta-python/recipes-devtools/python/python3-ninja_1.13.0.bb
Jiaying Song 2a4bed73a9 python3-ninja: fix ninja_syntax import and version for setuptools build
Fixes issues introduced in commit 16a72067f5 ("python3-ninja: upgrade
1.11.1.1 -> 1.13.0").

Upstream's __init__.py uses a relative import:
  from .ninja_syntax import Writer, escape, expand

This requires ninja_syntax.py to be present inside the ninja package
directory. Upstream relies on CMake (via scikit-build-core) to copy
ninja_syntax.py from ninja-upstream/misc/ into the package during
build [1]. Since the OE recipe replaces scikit-build-core with
setuptools (no-scikit-build.patch), CMake is not invoked and this
copy does not happen, causing ImportError at runtime.

Similarly, upstream uses scikit-build-core's generate feature to
create _version.py from the SCM version. With setuptools, this
does not happen automatically, so generate it in do_configure.

[1] https://github.com/scikit-build/ninja-python-distributions/commit/f3b4a786be

Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-04-02 16:05:46 +00:00

32 lines
825 B
BlitzBasic

SUMMARY = "Ninja is a small build system with a focus on speed"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE_Apache_20;md5=19cbd64715b51267a47bf3750cc6a8a5"
PYPI_PACKAGE = "ninja"
PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
inherit pypi python_setuptools_build_meta
SRC_URI[sha256sum] = "4a40ce995ded54d9dc24f8ea37ff3bf62ad192b547f6c7126e7e25045e76f978"
SRC_URI += "file://no-scikit-build.patch "
DEPENDS += "python3-setuptools-scm-native"
do_install:append () {
rm -rf ${D}${bindir}
install -m 0644 ${S}/ninja-upstream/misc/ninja_syntax.py ${D}${PYTHON_SITEPACKAGES_DIR}/ninja/ninja_syntax.py
}
do_configure:prepend() {
echo 'version = "${PV}"' > ${S}/src/ninja/_version.py
}
RDEPENDS:${PN} = " \
ninja \
python3-io \
python3-json \
python3-ninja-syntax \
"
BBCLASSEXTEND = "native nativesdk"