PKGBUILDs/extra/python-awkward/PKGBUILD
2025-02-01 00:27:04 +00:00

132 lines
3.8 KiB
Bash

# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Konstantin Gizdov <arch at kge dot pw>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove cuda make/optdepends
# - move python-pyaml, pybind11 to makedepends
# - add python-setuptools to makedepends
_pkgname=awkward
pkgbase="python-${_pkgname}"
# pkgname=("${pkgbase}" "${pkgbase}-docs") - docs require many new dependencies
pkgname=$pkgbase
pkgver=2.7.4
pkgrel=1
pkgdesc="Manipulate jagged, chunky, and/or bitmasked arrays as easily as Numpy"
url="https://github.com/scikit-hep/awkward"
license=(BSD-3-Clause)
arch=(x86_64)
depends=(
gcc-libs
glibc
python
python-fsspec
python-numpy
python-packaging
python-typing_extensions
)
makedepends=(
cmake
doxygen
git
pybind11
python-build
python-hatch-fancy-pypi-readme
python-hatchling
python-installer
python-nox
python-pyaml
python-scikit-build-core
python-setuptools
python-sphinx
python-sphinx_rtd_theme
)
checkdepends=(
python-hist
python-numba
python-numexpr
python-pandas
python-pyarrow
python-pytest
python-scikit-hep-testdata
python-vector
root
)
optdepends=(
'python-numba: for using in Numba JIT functions'
'python-numexpr: numexpr connector'
'python-pandas: pandas connector'
'python-pyarrow: pyArrow connector'
'root: rdataframe connector'
)
source=(
"${pkgname}::git+https://github.com/scikit-hep/${_pkgname}#tag=v${pkgver}"
"${pkgname}-rapidjson::git+https://github.com/Tencent/rapidjson.git"
)
sha512sums=('25626373f530c26552c3abfb1a50d52a0c16d29581090fa220255fca7021e99dfa7c03a44a9f719f4b6174df933976c0731e4a08c136339d91e9a04f55693a61'
'SKIP')
prepare() {
cd $pkgbase
git submodule init
git config submodule."rapidjson".url "${srcdir}/${pkgname}"-rapidjson
git -c protocol.file.allow=always submodule update --init --recursive
}
build() {
cd $pkgbase
nox -s prepare
python -m build --wheel --no-isolation
cd awkward-cpp
python -m build --wheel --no-isolation
}
check() {
local pytest_options=(
-vv
# AttributeError: 'FrameLocalsProxy' object has no attribute 'clear'
--deselect tests/test_0119_numexpr_and_broadcast_arrays.py::test_numexpr
# pyarrow.lib.ArrowInvalid: Column 'x' is declared non-nullable but contains nulls
--deselect tests/test_1125_to_arrow_from_arrow.py::test_recordarray
# pyarrow.lib.ArrowInvalid: Column '0' is declared non-nullable but contains nulls
--deselect tests/test_1294_to_and_from_parquet.py::test_recordarray
# RuntimeError: file metadata is only available after writer close
--deselect tests/test_1440_start_v2_to_parquet.py::test_recordarray[True-True]
)
cd $pkgbase
python -m venv --system-site-packages test-env
test-env/bin/python -m installer dist/*.whl
test-env/bin/python -m installer awkward-cpp/dist/*.whl
test-env/bin/python -m pytest "${pytest_options[@]}" tests
}
package_python-awkward() {
optdepends+=("${pkgbase}-docs: documentation")
cd $pkgbase
python -m installer --destdir="${pkgdir}" dist/*.whl
install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
cd awkward-cpp
python -m installer --destdir="${pkgdir}" dist/*.whl
}
package_python-awkward-docs() {
pkgdesc+=" - documentation"
cd $pkgbase
install -D LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -D README.md "${pkgdir}/usr/share/${pkgbase}/README.md"
python -m installer --destdir=tmp-install dist/*.whl
python -m installer --destdir=tmp-install awkward-cpp/dist/*.whl
install -d "${pkgdir}/usr/share/doc/${pkgbase}"
PYTHONPATH="${PWD}"/tmp-install/`python -c 'import site; print(site.getsitepackages()[0])'` sphinx-build "${PWD}/docs" "${pkgdir}/usr/share/doc/${pkgbase}"
}