From 763971d65b3dfc1446739415cbe0ba14784af411 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowalski Date: Thu, 14 Mar 2024 20:24:55 +0100 Subject: [PATCH] add pytango --- .../python3-scikit-build-core.inc | 12 ++++++ .../0001-use-env-cmake-and-ninja.patch | 38 +++++++++++++++++++ .../python3-scikit-build-core_0.8.2.bb | 4 ++ recipes-python/pytango/python3-pytango.inc | 25 ++++++++++++ .../pytango/python3-pytango_9.5.0.bb | 6 +++ 5 files changed, 85 insertions(+) create mode 100644 recipes-devtools/scikit-build-core/python3-scikit-build-core.inc create mode 100644 recipes-devtools/scikit-build-core/python3-scikit-build-core/0001-use-env-cmake-and-ninja.patch create mode 100644 recipes-devtools/scikit-build-core/python3-scikit-build-core_0.8.2.bb create mode 100644 recipes-python/pytango/python3-pytango.inc create mode 100644 recipes-python/pytango/python3-pytango_9.5.0.bb diff --git a/recipes-devtools/scikit-build-core/python3-scikit-build-core.inc b/recipes-devtools/scikit-build-core/python3-scikit-build-core.inc new file mode 100644 index 0000000..1cb69f6 --- /dev/null +++ b/recipes-devtools/scikit-build-core/python3-scikit-build-core.inc @@ -0,0 +1,12 @@ +SUMMARY = "Build backend for Python that uses CMake to build extension modules." +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b4e748e5f102e31c9390dcd6fa66f09" + +PYPI_PACKAGE = "scikit_build_core" +SRC_URI += "file://0001-use-env-cmake-and-ninja.patch" + +DEPENDS = "python3-hatch-vcs-native" +RDEPENDS:${PN} = "cmake python3-cmake python3-ninja python3-pyproject-metadata" +inherit allarch python3targetconfig pypi python_hatchling + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/scikit-build-core/python3-scikit-build-core/0001-use-env-cmake-and-ninja.patch b/recipes-devtools/scikit-build-core/python3-scikit-build-core/0001-use-env-cmake-and-ninja.patch new file mode 100644 index 0000000..3e7e33c --- /dev/null +++ b/recipes-devtools/scikit-build-core/python3-scikit-build-core/0001-use-env-cmake-and-ninja.patch @@ -0,0 +1,38 @@ +--- scikit_build_core-0.8.2/src/scikit_build_core/program_search.py 2020-02-02 01:00:00.000000000 +0100 ++++ scikit_build_core-0.8.2-yocto/src/scikit_build_core/program_search.py 2024-03-14 14:35:34.768039243 +0100 +@@ -38,12 +38,12 @@ def _get_cmake_path(*, module: bool = Tr + """ + Get the path to CMake. + """ +- if module: +- with contextlib.suppress(ImportError): +- # If a "cmake" directory exists, this will also ImportError +- from cmake import CMAKE_BIN_DIR +- +- yield Path(CMAKE_BIN_DIR) / "cmake" ++# if module: ++# with contextlib.suppress(ImportError): ++# # If a "cmake" directory exists, this will also ImportError ++# from cmake import CMAKE_BIN_DIR ++# ++# yield Path(CMAKE_BIN_DIR) / "cmake" + + candidates = ("cmake3", "cmake") + for candidate in candidates: +@@ -57,11 +57,11 @@ def _get_ninja_path(*, module: bool = Tr + Get the path to ninja. + """ + +- if module: +- with contextlib.suppress(ImportError): +- from ninja import BIN_DIR +- +- yield Path(BIN_DIR) / "ninja" ++# if module: ++# with contextlib.suppress(ImportError): ++# from ninja import BIN_DIR ++# ++# yield Path(BIN_DIR) / "ninja" + + # Matches https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeNinjaFindMake.cmake + candidates = ("ninja-build", "ninja", "samu") diff --git a/recipes-devtools/scikit-build-core/python3-scikit-build-core_0.8.2.bb b/recipes-devtools/scikit-build-core/python3-scikit-build-core_0.8.2.bb new file mode 100644 index 0000000..f0ac8ba --- /dev/null +++ b/recipes-devtools/scikit-build-core/python3-scikit-build-core_0.8.2.bb @@ -0,0 +1,4 @@ +require python3-scikit-build-core.inc + +# pypi package for 0.8.2 +SRC_URI[sha256sum] = "50ec24b9568c9aa6e27233deeb2978932bc79856212b30575cbfa4049655c436" diff --git a/recipes-python/pytango/python3-pytango.inc b/recipes-python/pytango/python3-pytango.inc new file mode 100644 index 0000000..6b71f19 --- /dev/null +++ b/recipes-python/pytango/python3-pytango.inc @@ -0,0 +1,25 @@ +SUMMARY = "Python binding for Tango" +LICENSE = "LGPL-3.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=6fabb2820b872d5b3106bddba78021f5" + +DEPENDS = "libtango boost omniorb zeromq cppzmq python3-numpy-native python3-scikit-build-core-native" +RDEPENDS:${PN} = "python3 python3-numpy python3-packaging" + +# for toolchain.cmake file +inherit cmake +inherit python3targetconfig pkgconfig pypi python_pep517 + +# TODO: Why is python include dir not found automatically? +export CMAKE_ARGS = "-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake -DPython_INCLUDE_DIR=${STAGING_DIR_TARGET}${includedir}/${PYTHON_DIR}" + +do_configure:prepend() { + # only depend on pytango's hard numpy requirement, as the only numpy + # available is the one provided by python3-numpy package anyway and + # the one provided by oldest-supported-numpy is not + required_numpy=`cat ${S}/pyproject.toml | grep -F numpy | grep -Fv requires | awk -F'[()]' '{print $2}'` + sed -i "s/oldest-supported-numpy/numpy ($required_numpy)/" ${S}/pyproject.toml +} + +FILES:${PN} = "${PYTHON_SITEPACKAGES_DIR}" + +BBCLASSEXTEND = "nativesdk" diff --git a/recipes-python/pytango/python3-pytango_9.5.0.bb b/recipes-python/pytango/python3-pytango_9.5.0.bb new file mode 100644 index 0000000..311a27b --- /dev/null +++ b/recipes-python/pytango/python3-pytango_9.5.0.bb @@ -0,0 +1,6 @@ +require python3-pytango.inc + +# pypi package for 9.5.0 +SRC_URI[sha256sum] = "559cb367c8f336c382cfcc3fb86a523a599c6f01d00bc9ad89ca7a363793182c" + +PREFERRED_VERSION_libtango = "9.5.%"