|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +DISTUTILS_USE_PEP517=setuptools |
| 7 | +PYTHON_FULLY_TESTED=( python3_{10..13} ) |
| 8 | +PYTHON_COMPAT=( "${PYTHON_FULLY_TESTED[@]}" ) |
| 9 | + |
| 10 | +inherit distutils-r1 multiprocessing optfeature pypi virtualx |
| 11 | + |
| 12 | +DESCRIPTION="Python tools to manipulate graphs and complex networks" |
| 13 | +HOMEPAGE=" |
| 14 | + https://networkx.org/ |
| 15 | + https://github.com/networkx/networkx/ |
| 16 | + https://pypi.org/project/networkx/ |
| 17 | +" |
| 18 | + |
| 19 | +LICENSE="BSD" |
| 20 | +SLOT="0" |
| 21 | +KEYWORDS="amd64 arm arm64 ~loong ~ppc64 ~riscv ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" |
| 22 | + |
| 23 | +BDEPEND=" |
| 24 | + test? ( |
| 25 | + >=dev-python/lxml-4.6[${PYTHON_USEDEP}] |
| 26 | + dev-python/pytest-xdist[${PYTHON_USEDEP}] |
| 27 | + $(python_gen_cond_dep ' |
| 28 | + >=dev-python/matplotlib-3.7[${PYTHON_USEDEP}] |
| 29 | + >=dev-python/numpy-1.24[${PYTHON_USEDEP}] |
| 30 | + >=dev-python/scipy-1.11.2[${PYTHON_USEDEP}] |
| 31 | + ' "${PYTHON_FULLY_TESTED[@]}") |
| 32 | + ) |
| 33 | +" |
| 34 | + |
| 35 | +distutils_enable_tests pytest |
| 36 | + |
| 37 | +src_test() { |
| 38 | + virtx distutils-r1_src_test |
| 39 | +} |
| 40 | + |
| 41 | +python_test() { |
| 42 | + if use x86 ; then |
| 43 | + EPYTEST_DESELECT+=( |
| 44 | + # https://github.com/networkx/networkx/issues/5913 (bug #921958) |
| 45 | + networkx/algorithms/approximation/tests/test_traveling_salesman.py::test_asadpour_tsp |
| 46 | + ) |
| 47 | + fi |
| 48 | + |
| 49 | + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 |
| 50 | + # virtx implies nonfatal |
| 51 | + nonfatal epytest -p xdist -n "$(makeopts_jobs)" --dist=worksteal || die |
| 52 | +} |
| 53 | + |
| 54 | +src_install() { |
| 55 | + distutils-r1_src_install |
| 56 | + # those examples use various assets and pre-compressed files |
| 57 | + docompress -x /usr/share/doc/${PF}/examples |
| 58 | +} |
| 59 | + |
| 60 | +pkg_postinst() { |
| 61 | + optfeature "recommended dependencies" "dev-python/matplotlib dev-python/numpy dev-python/pandas dev-python/scipy" |
| 62 | + optfeature "graph drawing and graph layout algorithms" "dev-python/pygraphviz dev-python/pydot" |
| 63 | + optfeature "YAML format reading and writing" "dev-python/pyyaml" |
| 64 | + optfeature "shapefile format reading and writing" "sci-libs/gdal[python]" |
| 65 | + optfeature "GraphML XML format" "dev-python/lxml" |
| 66 | +} |
0 commit comments