|
| 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_SINGLE_IMPL=1 |
| 7 | +DISTUTILS_USE_PEP517=setuptools |
| 8 | +PYTHON_COMPAT=( python3_{11..12} ) |
| 9 | + |
| 10 | +inherit distutils-r1 udev |
| 11 | + |
| 12 | +DESCRIPTION="An open source ecosystem for IoT development" |
| 13 | +HOMEPAGE="https://platformio.org/" |
| 14 | +SRC_URI="https://github.com/platformio/platformio-core/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz" |
| 15 | +S="${WORKDIR}"/${PN}-core-${PV} |
| 16 | + |
| 17 | +LICENSE="BSD" |
| 18 | +SLOT="0" |
| 19 | +KEYWORDS="amd64 arm arm64 x86" |
| 20 | + |
| 21 | +RDEPEND=" |
| 22 | + $(python_gen_cond_dep ' |
| 23 | + ~dev-python/bottle-0.12.25[${PYTHON_USEDEP}] |
| 24 | + >=dev-python/click-8.0.4[${PYTHON_USEDEP}] |
| 25 | + <dev-python/click-9[${PYTHON_USEDEP}] |
| 26 | + dev-python/colorama[${PYTHON_USEDEP}] |
| 27 | + ~dev-python/marshmallow-3.21.1[${PYTHON_USEDEP}] |
| 28 | + ~dev-python/pyserial-3.5[${PYTHON_USEDEP}] |
| 29 | + dev-python/requests[${PYTHON_USEDEP}] |
| 30 | + >=dev-python/semantic-version-2.10[${PYTHON_USEDEP}] |
| 31 | + <dev-python/semantic-version-3[${PYTHON_USEDEP}] |
| 32 | + <dev-python/tabulate-1[${PYTHON_USEDEP}] |
| 33 | + ~dev-python/ajsonrpc-1.2.0[${PYTHON_USEDEP}] |
| 34 | + >=dev-python/starlette-0.21[${PYTHON_USEDEP}] |
| 35 | + >=dev-python/uvicorn-0.19[${PYTHON_USEDEP}] |
| 36 | + dev-python/wsproto[${PYTHON_USEDEP}] |
| 37 | + >=dev-python/pyelftools-0.27[${PYTHON_USEDEP}] |
| 38 | + <dev-python/pyelftools-1[${PYTHON_USEDEP}] |
| 39 | + ') |
| 40 | + virtual/udev" |
| 41 | +DEPEND="virtual/udev" |
| 42 | +BDEPEND="test? ( $(python_gen_cond_dep 'dev-python/jsondiff[${PYTHON_USEDEP}]') )" |
| 43 | + |
| 44 | +# This list could be refined a bit to have individual tests which need network |
| 45 | +# (within EPYTEST_DESELECT) but so many need it that it doesn't seem worth it right now. |
| 46 | +EPYTEST_IGNORE=( |
| 47 | + # Requires network access |
| 48 | + tests/test_builder.py |
| 49 | + tests/package/test_manager.py |
| 50 | + tests/package/test_manifest.py |
| 51 | + tests/commands/test_platform.py |
| 52 | + tests/commands/test_test.py |
| 53 | + tests/commands/test_ci.py |
| 54 | + tests/commands/test_init.py |
| 55 | + tests/commands/test_lib.py |
| 56 | + tests/commands/test_lib_complex.py |
| 57 | + tests/commands/test_boards.py |
| 58 | + tests/commands/test_check.py |
| 59 | + tests/commands/test_run.py |
| 60 | + tests/commands/pkg/test_exec.py |
| 61 | + tests/commands/pkg/test_list.py |
| 62 | + tests/commands/pkg/test_outdated.py |
| 63 | + tests/commands/pkg/test_search.py |
| 64 | + tests/commands/pkg/test_show.py |
| 65 | + tests/commands/pkg/test_install.py |
| 66 | + tests/commands/pkg/test_uninstall.py |
| 67 | + tests/commands/pkg/test_update.py |
| 68 | + tests/misc/ino2cpp/test_ino2cpp.py |
| 69 | + tests/test_maintenance.py |
| 70 | + tests/test_misc.py |
| 71 | +) |
| 72 | + |
| 73 | +EPYTEST_DESELECT=( |
| 74 | + # Requires network access |
| 75 | + tests/misc/test_maintenance.py::test_check_pio_upgrade |
| 76 | + tests/misc/test_misc.py::test_ping_internet_ips |
| 77 | + tests/misc/test_misc.py::test_api_cache |
| 78 | +) |
| 79 | + |
| 80 | +distutils_enable_tests pytest |
| 81 | + |
| 82 | +python_prepare_all() { |
| 83 | + # Allow newer versions of: |
| 84 | + # - zeroconf, bug #831181. |
| 85 | + # - wsproto |
| 86 | + # - semantic_version, bug #853247 |
| 87 | + # - starlette & uvicorn, bug #888427 |
| 88 | + sed \ |
| 89 | + -e '/zeroconf/s/<[0-9.*]*//' \ |
| 90 | + -e '/wsproto/s/==.*/"/' \ |
| 91 | + -e '/semantic_version/s/==[0-9.*]*//' \ |
| 92 | + -e '/starlette/s/==.*/"/' \ |
| 93 | + -e '/uvicorn/s/==.*/"/' \ |
| 94 | + -i setup.py || die |
| 95 | + |
| 96 | + distutils-r1_python_prepare_all |
| 97 | +} |
| 98 | + |
| 99 | +python_test() { |
| 100 | + epytest -k "not skip_ci" |
| 101 | +} |
| 102 | + |
| 103 | +src_install() { |
| 104 | + distutils-r1_src_install |
| 105 | + udev_dorules platformio/assets/system/99-platformio-udev.rules |
| 106 | +} |
| 107 | + |
| 108 | +pkg_postinst() { |
| 109 | + udev_reload |
| 110 | +} |
| 111 | + |
| 112 | +pkg_postrm() { |
| 113 | + udev_reload |
| 114 | +} |
0 commit comments