diff --git a/devel/nanobind/Makefile b/devel/nanobind/Makefile index 7932cf26c5e8..fffc983c9e56 100644 --- a/devel/nanobind/Makefile +++ b/devel/nanobind/Makefile @@ -1,63 +1,71 @@ PORTNAME= nanobind DISTVERSIONPREFIX= v -DISTVERSION= 2.4.0 +DISTVERSION= 2.12.0 CATEGORIES= devel MAINTAINER= yuri@FreeBSD.org COMMENT= Tiny and efficient C++/Python bindings (C++ version) WWW= https://nanobind.readthedocs.io/en/latest/ \ https://github.com/wjakob/nanobind LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= robin-map>0:devel/robin-map RUN_DEPENDS= robin-map>0:devel/robin-map -TEST_DEPENDS= gmake:devel/gmake +TEST_DEPENDS= eigen>0:math/eigen3 \ + gmake:devel/gmake \ + pytest:devel/py-pytest@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}jax>0:math/py-jax@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}numpy>0:math/py-numpy@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR} +# ${PYTHON_PKGNAMEPREFIX}tensorflow>0:science/py-tensorflow@${PY_FLAVORA} # tensorflow tests crash the python process -USES= cmake localbase python:test +USES= cmake:testing localbase python:test USE_GITHUB= yes GH_ACCOUNT= wjakob CMAKE_ARGS= -DNB_INSTALL_DATADIR=${PREFIX} CMAKE_ON= NB_CREATE_INSTALL_RULES CMAKE_OFF= NB_USE_SUBMODULE_DEPS \ NB_TEST_FREE_THREADED \ NB_TEST \ CMAKE_SKIP_INSTALL_RULES +CMAKE_TESTING_ON= NB_TEST +CMAKE_TESTING_TARGET= copy-tests CXXFLAGS+= -I${WRKSRC}/include \ -I${PYTHON_INCLUDEDIR} +INSTALL_TARGET= install + +TEST_WRKSRC= ${BUILD_WRKSRC}/tests + NO_ARCH= yes -do-install: - # install manually because the default framework-provided install op fails for some reason - cd ${BUILD_WRKSRC} && \ - ${SETENV} DESTDIR=${STAGEDIR} ${MAKE_CMD} install - # remove unnecessary files +post-install: + # workaround for https://github.com/wjakob/nanobind/issues/1300 @${RM} \ ${STAGEDIR}${PREFIX}/cmake/darwin-ld-cpython.sym \ ${STAGEDIR}${PREFIX}/cmake/darwin-ld-pypy.sym \ - ${STAGEDIR}${DATADIR}/__init__.py \ - ${STAGEDIR}${DATADIR}/__main__.py - -do-test: - @cd ${WRKSRC} && \ - ${RM} -r test && \ - ${MKDIR} test && \ - cd test && \ - ${CP} ${FILESDIR}/CMakeLists.txt ${FILESDIR}/my_ext.cpp . && \ - cmake -DCMAKE_PREFIX_PATH="${STAGEDIR}${PREFIX}" . && \ - ${SETENV} CXXFLAGS="${CXXFLAGS} -I${STAGEDIR}${PREFIX}/include" ${GMAKE} -j ${MAKE_JOBS_NUMBER} && \ - if [ `${PYTHON_CMD} -c "import my_ext; print(my_ext.add(1, 2))"` = 3 ]; then \ - ${ECHO} "Test succeeded"; \ - else \ - ${ECHO} "Test failed"; \ - return 1; \ - fi + ${STAGEDIR}${PREFIX}/cmake/darwin-python-path.py + # correct path to the src directory in cmake file + @${REINPLACE_CMD} -e 's|$${NB_DIR}/src/|${DATADIR}/src/|g' \ + ${STAGEDIR}${PREFIX}/cmake/nanobind-config.cmake + +post-test: + @cd ${TEST_WRKSRC} && \ + pytest . + +# tests as of 2.12.0: +# Results (41.59s): +# 2 failed +# 1486 passed +# 19 skipped +# 2 warnings # cmake installs files into non-standard locations, see https://github.com/wjakob/nanobind/issues/810 # hostile upstream, do not create bug reports .include diff --git a/devel/nanobind/distinfo b/devel/nanobind/distinfo index 2cd0a61c9090..bebc9ffdbd69 100644 --- a/devel/nanobind/distinfo +++ b/devel/nanobind/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1733460759 -SHA256 (wjakob-nanobind-v2.4.0_GH0.tar.gz) = bb35deaed7efac5029ed1e33880a415638352f757d49207a8e6013fefb6c49a7 -SIZE (wjakob-nanobind-v2.4.0_GH0.tar.gz) = 890566 +TIMESTAMP = 1772385576 +SHA256 (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 01f1f0cd0398743c18f33d07ae36ad410bd7f4a1e90683b508504de897d6e629 +SIZE (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 940575 diff --git a/devel/nanobind/files/patch-cmake_nanobind-config.cmake b/devel/nanobind/files/patch-cmake_nanobind-config.cmake deleted file mode 100644 index c3c581c7304b..000000000000 --- a/devel/nanobind/files/patch-cmake_nanobind-config.cmake +++ /dev/null @@ -1,46 +0,0 @@ ---- cmake/nanobind-config.cmake.orig 2024-12-05 23:06:19 UTC -+++ cmake/nanobind-config.cmake -@@ -166,19 +166,19 @@ function (nanobind_build_library TARGET_NAME) - ${NB_DIR}/include/nanobind/eigen/dense.h - ${NB_DIR}/include/nanobind/eigen/sparse.h - -- ${NB_DIR}/src/buffer.h -- ${NB_DIR}/src/hash.h -- ${NB_DIR}/src/nb_internals.h -- ${NB_DIR}/src/nb_internals.cpp -- ${NB_DIR}/src/nb_func.cpp -- ${NB_DIR}/src/nb_type.cpp -- ${NB_DIR}/src/nb_enum.cpp -- ${NB_DIR}/src/nb_ndarray.cpp -- ${NB_DIR}/src/nb_static_property.cpp -- ${NB_DIR}/src/common.cpp -- ${NB_DIR}/src/error.cpp -- ${NB_DIR}/src/trampoline.cpp -- ${NB_DIR}/src/implicit.cpp -+ ${NB_DIR}/share/nanobind/src/buffer.h -+ ${NB_DIR}/share/nanobind/src/hash.h -+ ${NB_DIR}/share/nanobind/src/nb_internals.h -+ ${NB_DIR}/share/nanobind/src/nb_internals.cpp -+ ${NB_DIR}/share/nanobind/src/nb_func.cpp -+ ${NB_DIR}/share/nanobind/src/nb_type.cpp -+ ${NB_DIR}/share/nanobind/src/nb_enum.cpp -+ ${NB_DIR}/share/nanobind/src/nb_ndarray.cpp -+ ${NB_DIR}/share/nanobind/src/nb_static_property.cpp -+ ${NB_DIR}/share/nanobind/src/common.cpp -+ ${NB_DIR}/share/nanobind/src/error.cpp -+ ${NB_DIR}/share/nanobind/src/trampoline.cpp -+ ${NB_DIR}/share/nanobind/src/implicit.cpp - ) - - if (TARGET_TYPE STREQUAL "SHARED") -@@ -400,8 +400,8 @@ function (nanobind_add_stub name) - function (nanobind_add_stub name) - cmake_parse_arguments(PARSE_ARGV 1 ARG "VERBOSE;INCLUDE_PRIVATE;EXCLUDE_DOCSTRINGS;INSTALL_TIME;EXCLUDE_FROM_ALL" "MODULE;OUTPUT;MARKER_FILE;COMPONENT;PATTERN_FILE" "PYTHON_PATH;DEPENDS") - -- if (EXISTS ${NB_DIR}/src/stubgen.py) -- set(NB_STUBGEN "${NB_DIR}/src/stubgen.py") -+ if (EXISTS ${NB_DIR}/share/nanobind/stubgen.py) -+ set(NB_STUBGEN "${NB_DIR}/share/nanobind/stubgen.py") - elseif (EXISTS ${NB_DIR}/stubgen.py) - set(NB_STUBGEN "${NB_DIR}/stubgen.py") - else() diff --git a/devel/nanobind/pkg-plist b/devel/nanobind/pkg-plist index db399f3174aa..c64e45ee7db0 100644 --- a/devel/nanobind/pkg-plist +++ b/devel/nanobind/pkg-plist @@ -1,74 +1,79 @@ cmake/nanobind-config-version.cmake cmake/nanobind-config.cmake include/nanobind/eigen/dense.h include/nanobind/eigen/sparse.h include/nanobind/eval.h include/nanobind/intrusive/counter.h include/nanobind/intrusive/counter.inl include/nanobind/intrusive/ref.h include/nanobind/make_iterator.h include/nanobind/nanobind.h include/nanobind/nb_accessor.h include/nanobind/nb_attr.h include/nanobind/nb_call.h include/nanobind/nb_cast.h include/nanobind/nb_class.h include/nanobind/nb_defs.h include/nanobind/nb_descr.h include/nanobind/nb_enums.h include/nanobind/nb_error.h include/nanobind/nb_func.h include/nanobind/nb_lib.h include/nanobind/nb_misc.h include/nanobind/nb_python.h include/nanobind/nb_traits.h include/nanobind/nb_tuple.h include/nanobind/nb_types.h include/nanobind/ndarray.h include/nanobind/operators.h include/nanobind/stl/array.h include/nanobind/stl/bind_map.h include/nanobind/stl/bind_vector.h include/nanobind/stl/chrono.h include/nanobind/stl/complex.h include/nanobind/stl/detail/chrono.h include/nanobind/stl/detail/nb_array.h include/nanobind/stl/detail/nb_dict.h include/nanobind/stl/detail/nb_list.h include/nanobind/stl/detail/nb_optional.h include/nanobind/stl/detail/nb_set.h include/nanobind/stl/detail/traits.h include/nanobind/stl/filesystem.h include/nanobind/stl/function.h include/nanobind/stl/list.h include/nanobind/stl/map.h include/nanobind/stl/optional.h include/nanobind/stl/pair.h include/nanobind/stl/set.h include/nanobind/stl/shared_ptr.h include/nanobind/stl/string.h include/nanobind/stl/string_view.h include/nanobind/stl/tuple.h include/nanobind/stl/unique_ptr.h include/nanobind/stl/unordered_map.h include/nanobind/stl/unordered_set.h include/nanobind/stl/variant.h include/nanobind/stl/vector.h include/nanobind/stl/wstring.h include/nanobind/trampoline.h include/nanobind/typing.h +%%DATADIR%%/__init__.py +%%DATADIR%%/__main__.py %%DATADIR%%/src/buffer.h %%DATADIR%%/src/common.cpp %%DATADIR%%/src/error.cpp %%DATADIR%%/src/hash.h %%DATADIR%%/src/implicit.cpp +%%DATADIR%%/src/nb_abi.h %%DATADIR%%/src/nb_combined.cpp %%DATADIR%%/src/nb_enum.cpp +%%DATADIR%%/src/nb_ft.cpp +%%DATADIR%%/src/nb_ft.h %%DATADIR%%/src/nb_func.cpp %%DATADIR%%/src/nb_internals.cpp %%DATADIR%%/src/nb_internals.h %%DATADIR%%/src/nb_ndarray.cpp %%DATADIR%%/src/nb_static_property.cpp %%DATADIR%%/src/nb_type.cpp %%DATADIR%%/src/trampoline.cpp %%DATADIR%%/stubgen.py diff --git a/devel/py-nanobind/Makefile b/devel/py-nanobind/Makefile index fa28fdd1ad01..f2cf8e29c071 100644 --- a/devel/py-nanobind/Makefile +++ b/devel/py-nanobind/Makefile @@ -1,40 +1,45 @@ PORTNAME= nanobind DISTVERSIONPREFIX= v -DISTVERSION= 2.4.0 +DISTVERSION= 2.12.0 CATEGORIES= devel python #MASTER_SITES= PYPI # no tarball PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Tiny and efficient C++/Python bindings WWW= https://github.com/wjakob/nanobind LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}scikit-build-core>0:devel/py-scikit-build-core@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} \ cmake:devel/cmake-core TEST_DEPENDS= cmake:devel/cmake-core USES= python USE_PYTHON= pep517 autoplist pytest USE_GITHUB= yes GH_ACCOUNT= wjakob GH_TUPLE= Tessil:robin-map:188c455:robin_map/ext/robin_map -TEST_WRKSRC= ${WRKSRC}/tests +TEST_WRKSRC= ${BUILD_WRKSRC}/tests TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} NO_ARCH= yes pre-test: # build test extensions @cd ${WRKSRC} && \ - ${SETENV} ${MAKE_ENV} cmake . && \ + ${SETENV} ${MAKE_ENV} cmake -DPython_EXECUTABLE=${PYTHON_CMD} . && \ ${SETENV} ${MAKE_ENV} ${MAKE} -j${MAKE_JOBS_NUMBER} -# tests fail to compile: Free-threaded extensions require a free-threaded version of Python +# tests as of 2.12.0: +# Results (46.91s): +# 2 failed +# 1495 passed +# 19 skipped +# 2 warnings .include diff --git a/devel/py-nanobind/distinfo b/devel/py-nanobind/distinfo index aff759921ca3..3a81d3c45e9d 100644 --- a/devel/py-nanobind/distinfo +++ b/devel/py-nanobind/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1733477888 -SHA256 (wjakob-nanobind-v2.4.0_GH0.tar.gz) = bb35deaed7efac5029ed1e33880a415638352f757d49207a8e6013fefb6c49a7 -SIZE (wjakob-nanobind-v2.4.0_GH0.tar.gz) = 890566 +TIMESTAMP = 1772389974 +SHA256 (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 01f1f0cd0398743c18f33d07ae36ad410bd7f4a1e90683b508504de897d6e629 +SIZE (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 940575 SHA256 (Tessil-robin-map-188c455_GH0.tar.gz) = c3f05ed8933a1f9aa57295c8ad17bd44756cf5cf030a95325c61aa862fa19680 SIZE (Tessil-robin-map-188c455_GH0.tar.gz) = 70577 diff --git a/science/py-phono3py/files/patch-pyproject.toml b/science/py-phono3py/files/patch-pyproject.toml new file mode 100644 index 000000000000..c651c0fc4530 --- /dev/null +++ b/science/py-phono3py/files/patch-pyproject.toml @@ -0,0 +1,9 @@ +--- pyproject.toml.orig 2026-03-01 18:48:34 UTC ++++ pyproject.toml +@@ -1,5 +1,5 @@ + [build-system] +-requires = ["scikit-build-core", "nanobind<2.10.0", "numpy"] ++requires = ["scikit-build-core", "nanobind", "numpy"] + build-backend = "scikit_build_core.build" + + [project] diff --git a/science/py-phonopy/files/patch-pyproject.toml b/science/py-phonopy/files/patch-pyproject.toml new file mode 100644 index 000000000000..34603697161f --- /dev/null +++ b/science/py-phonopy/files/patch-pyproject.toml @@ -0,0 +1,9 @@ +--- pyproject.toml.orig 2026-03-01 18:46:34 UTC ++++ pyproject.toml +@@ -1,5 +1,5 @@ + [build-system] +-requires = ["scikit-build-core", "nanobind<2.10.0", "numpy"] ++requires = ["scikit-build-core", "nanobind", "numpy"] + build-backend = "scikit_build_core.build" + + [project]