sci-libs/spglib: add 2.7.0

python bindings:
add missing dev-python/setuptools-scm
upstream migrated the python API to use pybind11
use multi-python
enable py3.14

skip tests for examples, the testsuites are already quite extensive

Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/45246
Closes: https://github.com/gentoo/gentoo/pull/45246
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-01-04 18:28:37 +00:00
committed by Sam James
parent c84edad29d
commit 1e8d06d20e
2 changed files with 108 additions and 0 deletions
+1
View File
@@ -1 +1,2 @@
DIST spglib-2.6.0.tar.gz 2438640 BLAKE2B 99befe83edf51fbffdb815315e89e5bc9a882298e08ca79631ce2fbb17d302be529b6f4f326d60ee07bef330b8f217aa0111acaa1ec8f0562f2fb12be498db24 SHA512 a70a318dcfb0cfffca1d68605ec3afea6c5ff18ada6a4a1c0ea1c09f23ab8585d093aaf322939bc83cff28e8bb3b1b42ec65edce9208e4f69288504326e4cf2f
DIST spglib-2.7.0.tar.gz 2442495 BLAKE2B ddba5b5ea401b277b45c1e3b9b3df91da68f56d89eecf8e5f8be5aefd22df841fa79f4638cfe857005000b8c6095e192e052fc38b8d760f19bd3bff32908d16a SHA512 38b5e5c50bdda2c530f0b3f24d0f89e12965d0c2d1067e6d8501e677926c49de875fbcbd548185724427c0969aa6df328cc86dd077d3c692630b3cd26fa66476
+107
View File
@@ -0,0 +1,107 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
DISTUTILS_USE_PEP517=scikit-build-core
PYTHON_COMPAT=( python3_{11..14} )
FORTRAN_NEEDED=fortran
inherit cmake distutils-r1 fortran-2 toolchain-funcs
DESCRIPTION="Spglib is a C library for finding and handling crystal symmetries"
HOMEPAGE="https://github.com/spglib/spglib/"
SRC_URI="https://github.com/spglib/spglib/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0/2"
KEYWORDS="~amd64 ~x86"
IUSE="fortran openmp python test"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"
RDEPEND="
python? (
${PYTHON_DEPS}
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/ruamel-yaml[${PYTHON_USEDEP}]
$(python_gen_cond_dep '
dev-python/typing-extensions[${PYTHON_USEDEP}]
' 3.11 3.12)
)
"
DEPEND="
${RDEPEND}
python? ( dev-python/pybind11[${PYTHON_USEDEP}] )
"
BDEPEND="
python? (
${DISTUTILS_DEPS}
${PYTHON_DEPS}
dev-python/setuptools-scm[${PYTHON_USEDEP}]
test? ( dev-python/pyyaml[${PYTHON_USEDEP}] )
)
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}"/${PN}-2.6.0-pyproject.patch
"${FILESDIR}"/${PN}-2.6.0-dist_sources.patch
)
distutils_enable_tests pytest
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
use fortran && fortran-2_pkg_setup
use python && python_setup
}
src_prepare() {
cmake_src_prepare
use python && distutils-r1_src_prepare
}
src_configure() {
local mycmakeargs=(
-DCMAKE_SKIP_RPATH=ON
-DSPGLIB_SHARED_LIBS=ON
-DSPGLIB_USE_OMP="$(usex openmp)"
-DSPGLIB_WITH_Fortran="$(usex fortran)"
-DSPGLIB_WITH_Python="$(usex python)"
-DSPGLIB_WITH_TESTS="$(usex test)"
)
cmake_src_configure
}
src_compile() {
cmake_src_compile
use python && distutils-r1_src_compile
}
src_test() {
CMAKE_SKIP_TESTS=(
# the testsuites are already quite extensive
example-*
)
local -x LD_LIBRARY_PATH="${BUILD_DIR}:${BUILD_DIR}/fortran"
cmake_src_test
use python && distutils-r1_src_test
}
python_install() {
distutils-r1_python_install
# remove duplicate headers/lib
rm -r "${ED}"/$(python_get_sitedir)/spglib/{$(get_libdir),include} || die
}
src_install() {
cmake_src_install
use python && distutils-r1_src_install
}