# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.17.1

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=maturin
PYTHON_COMPAT=( python3_{12..14} )

CRATES="
	adler2@2.0.1
	android_system_properties@0.1.6
	autocfg@1.5.1
	base64@0.22.1
	bincode@1.3.3
	bitflags@1.3.2
	bumpalo@3.20.3
	byteorder@1.5.0
	cc@1.9.0
	cdshealpix@0.10.1
	cfg-if@1.0.5
	chrono@0.4.45
	colorous@1.0.16
	core-foundation-sys@0.8.7
	crc32fast@1.5.3
	crossbeam-deque@0.8.8
	crossbeam-epoch@0.9.21
	crossbeam-utils@0.8.23
	either@1.19.0
	equivalent@1.0.3
	fdeflate@0.3.7
	find-msvc-tools@0.1.15
	flate2@1.1.10
	futures-core@0.3.34
	futures-task@0.3.34
	futures-util@0.3.34
	hashbrown@0.17.1
	heck@0.5.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.65
	indexmap@2.14.2
	itertools@0.14.0
	js-sys@0.3.106
	katex-doc@0.1.0
	libc@0.2.191
	log@0.4.34
	mapproj@0.4.0
	matrixmultiply@0.3.11
	memchr@2.8.3
	memmap2@0.9.11
	miniz_oxide@0.8.9
	miniz_oxide@0.9.1
	ndarray@0.17.2
	num-bigint@0.4.8
	num-complex@0.4.6
	num-integer@0.1.47
	num-iter@0.1.46
	num-rational@0.4.2
	num-traits@0.2.19
	num@0.4.3
	numpy@0.29.0
	once_cell@1.21.4
	pin-project-lite@0.2.17
	png@0.17.16
	portable-atomic-util@0.2.8
	portable-atomic@1.15.0
	proc-macro2@1.0.107
	pyo3-build-config@0.29.3
	pyo3-ffi@0.29.3
	pyo3-macros-backend@0.29.3
	pyo3-macros@0.29.3
	pyo3@0.29.3
	quote@1.0.47
	rawpointer@0.2.1
	rayon-core@1.13.0
	rayon@1.12.0
	rustc-hash@2.1.3
	rustversion@1.0.23
	serde@1.0.229
	serde_core@1.0.229
	serde_derive@1.0.229
	serde_spanned@0.6.9
	shlex@2.0.1
	simd-adler32@0.3.10
	slab@0.4.12
	syn@2.0.119
	syn@3.0.9
	target-lexicon@0.13.5
	thiserror-impl@2.0.21
	thiserror@2.0.21
	toml@0.8.23
	toml_datetime@0.6.11
	toml_edit@0.22.27
	toml_write@0.1.2
	unicode-ident@1.0.27
	wasm-bindgen-macro-support@0.2.129
	wasm-bindgen-macro@0.2.129
	wasm-bindgen-shared@0.2.129
	wasm-bindgen@0.2.129
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-result@0.4.1
	windows-strings@0.5.1
	winnow@0.7.15
	zlib-rs@0.6.8
"

inherit cargo distutils-r1 pypi

DESCRIPTION="A healpix manipulation library"
HOMEPAGE="https://cds-astro.github.io/cds-healpix-python"
SRC_URI+=" ${CARGO_CRATE_URIS}"

LICENSE="BSD"
# Dependent crate licenses
LICENSE+=" Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 MIT Unicode-3.0 ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples plot"
RDEPEND="dev-python/astropy[${PYTHON_USEDEP}]
	plot? ( dev-python/matplotlib[${PYTHON_USEDEP}] )
"
BDEPEND="doc? ( virtual/pandoc )
	test? (
		dev-python/astropy-healpix[${PYTHON_USEDEP}]
		dev-python/matplotlib[${PYTHON_USEDEP}]
	)
"

EPYTEST_PLUGINS=( pytest-benchmark )
distutils_enable_tests pytest
distutils_enable_sphinx docs dev-python/sphinx-collections \
	dev-python/sphinx-copybutton \
	dev-python/sphinx-gallery \
	dev-python/sphinxcontrib-bibtex \
	dev-python/astropy-sphinx-theme \
	dev-python/numpydoc \
	dev-python/nbsphinx \
	dev-python/matplotlib \
	dev-python/mocpy

#python_prepare_all() {
#	use doc && { sed -i -e '/"source":/s|../||' -e '/"target":/s|note|docs/note|' docs/conf.py || die ; \
#		install -Dm644 notebooks/* -t docs/_collections/notebooks || die ; }
#	distutils-r1_python_prepare_all
#}

python_install_all() {
	if use examples; then
		docompress -x "/usr/share/doc/${PF}/notebooks"
		docinto notebooks
		dodoc -r notebooks/.
	fi

	distutils-r1_python_install_all
}

python_test() {
	epytest "${BUILD_DIR}"/install/$(python_get_sitedir)
}