|
| 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_COMPAT=( python3_{11..13} ) |
| 8 | +PYTHON_REQ_USE="threads(+)" |
| 9 | + |
| 10 | +inherit distutils-r1 |
| 11 | + |
| 12 | +MY_P=${P/_beta/b} |
| 13 | +DESCRIPTION="Python code static checker" |
| 14 | +HOMEPAGE=" |
| 15 | + https://pypi.org/project/pylint/ |
| 16 | + https://github.com/pylint-dev/pylint/ |
| 17 | +" |
| 18 | +SRC_URI=" |
| 19 | + https://github.com/pylint-dev/pylint/archive/v${PV/_beta/b}.tar.gz |
| 20 | + -> ${MY_P}.gh.tar.gz |
| 21 | +" |
| 22 | +S=${WORKDIR}/${MY_P} |
| 23 | + |
| 24 | +LICENSE="GPL-2" |
| 25 | +SLOT="0" |
| 26 | +KEYWORDS="amd64 arm arm64 x86" |
| 27 | +IUSE="examples" |
| 28 | + |
| 29 | +RDEPEND=" |
| 30 | + <dev-python/astroid-3.3[${PYTHON_USEDEP}] |
| 31 | + >=dev-python/astroid-3.2.2[${PYTHON_USEDEP}] |
| 32 | + >=dev-python/dill-0.3.7[${PYTHON_USEDEP}] |
| 33 | + >=dev-python/isort-4.2.5[${PYTHON_USEDEP}] |
| 34 | + <dev-python/isort-6[${PYTHON_USEDEP}] |
| 35 | + >=dev-python/mccabe-0.6[${PYTHON_USEDEP}] |
| 36 | + <dev-python/mccabe-0.8[${PYTHON_USEDEP}] |
| 37 | + >=dev-python/platformdirs-2.2.0[${PYTHON_USEDEP}] |
| 38 | + >=dev-python/tomlkit-0.10.1[${PYTHON_USEDEP}] |
| 39 | + $(python_gen_cond_dep ' |
| 40 | + >=dev-python/tomli-1.1.0[${PYTHON_USEDEP}] |
| 41 | + ' 3.10) |
| 42 | +" |
| 43 | +BDEPEND=" |
| 44 | + test? ( |
| 45 | + $(python_gen_cond_dep ' |
| 46 | + >=dev-python/GitPython-3[${PYTHON_USEDEP}] |
| 47 | + ' 'python*' ) |
| 48 | + <dev-python/pytest-8[${PYTHON_USEDEP}] |
| 49 | + dev-python/pytest-timeout[${PYTHON_USEDEP}] |
| 50 | + dev-python/typing-extensions[${PYTHON_USEDEP}] |
| 51 | + ) |
| 52 | +" |
| 53 | + |
| 54 | +distutils_enable_tests pytest |
| 55 | + |
| 56 | +python_test() { |
| 57 | + local EPYTEST_DESELECT=( |
| 58 | + # TODO |
| 59 | + 'tests/test_functional.py::test_functional[dataclass_with_field]' |
| 60 | + 'tests/test_functional.py::test_functional[no_name_in_module]' |
| 61 | + 'tests/test_functional.py::test_functional[recursion_error_3159]' |
| 62 | + 'tests/test_functional.py::test_functional[shadowed_import]' |
| 63 | + 'tests/test_functional.py::test_functional[use_yield_from]' |
| 64 | + 'tests/test_functional.py::test_functional[wrong_import_order]' |
| 65 | + ) |
| 66 | + local EPYTEST_IGNORE=( |
| 67 | + # No need to run the benchmarks |
| 68 | + tests/benchmark/test_baseline_benchmarks.py |
| 69 | + ) |
| 70 | + |
| 71 | + if ! has_version "dev-python/GitPython[${PYTHON_USEDEP}]"; then |
| 72 | + EPYTEST_IGNORE+=( |
| 73 | + tests/profile/test_profile_against_externals.py |
| 74 | + tests/testutils/_primer/test_package_to_lint.py |
| 75 | + tests/testutils/_primer/test_primer.py |
| 76 | + ) |
| 77 | + fi |
| 78 | + |
| 79 | + rm -rf pylint || die |
| 80 | + |
| 81 | + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 |
| 82 | + epytest -p timeout |
| 83 | +} |
| 84 | + |
| 85 | +python_install_all() { |
| 86 | + if use examples ; then |
| 87 | + docompress -x "/usr/share/doc/${PF}/examples" |
| 88 | + docinto examples |
| 89 | + dodoc -r examples/. |
| 90 | + fi |
| 91 | + |
| 92 | + distutils-r1_python_install_all |
| 93 | +} |
0 commit comments