summaryrefslogtreecommitdiff
blob: d19bf8c9d53a8a82844708ab2c34c2c04170d679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..10} )

inherit distutils-r1 udev

DESCRIPTION="An open source ecosystem for IoT development"
HOMEPAGE="https://platformio.org/"
SRC_URI="https://github.com/platformio/platformio-core/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}-core-${PV}

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="
	$(python_gen_cond_dep '
		=dev-python/aiofiles-22.1*[${PYTHON_USEDEP}]
		dev-python/ajsonrpc[${PYTHON_USEDEP}]
		<dev-python/bottle-0.13[${PYTHON_USEDEP}]
		=dev-python/click-8*[${PYTHON_USEDEP}]
		dev-python/colorama[${PYTHON_USEDEP}]
		>=dev-python/pyserial-3[${PYTHON_USEDEP}]
		<dev-python/pyserial-4[${PYTHON_USEDEP}]
		>=dev-python/python-zeroconf-0.37[${PYTHON_USEDEP}]
		=dev-python/requests-2*[${PYTHON_USEDEP}]
		>=dev-python/semantic_version-2.9[${PYTHON_USEDEP}]
		<dev-python/semantic_version-3[${PYTHON_USEDEP}]
		=dev-python/tabulate-0.9*[${PYTHON_USEDEP}]
		dev-python/twisted[${PYTHON_USEDEP}]
		>=dev-python/pyelftools-0.27[${PYTHON_USEDEP}]
		<dev-python/pyelftools-1[${PYTHON_USEDEP}]
		=dev-python/marshmallow-3*[${PYTHON_USEDEP}]
		=dev-python/starlette-0.21*[${PYTHON_USEDEP}]
		=dev-python/uvicorn-0.19*[${PYTHON_USEDEP}]
		dev-python/wsproto[${PYTHON_USEDEP}]
	')
	virtual/udev"
DEPEND="virtual/udev"
BDEPEND="test? ( $(python_gen_cond_dep 'dev-python/jsondiff[${PYTHON_USEDEP}]') )"

# This list could be refined a bit to have individual tests which need network
# (within EPYTEST_DESELECT) but so many need it that it doesn't seem worth it right now.
EPYTEST_IGNORE=(
	# Requires network access
	tests/test_builder.py
	tests/package/test_manager.py
	tests/package/test_manifest.py
	tests/commands/test_platform.py
	tests/commands/test_test.py
	tests/commands/test_ci.py
	tests/commands/test_init.py
	tests/commands/test_lib.py
	tests/commands/test_lib_complex.py
	tests/commands/test_boards.py
	tests/commands/test_check.py
	tests/commands/test_run.py
	tests/commands/pkg/test_exec.py
	tests/commands/pkg/test_list.py
	tests/commands/pkg/test_outdated.py
	tests/commands/pkg/test_search.py
	tests/commands/pkg/test_show.py
	tests/commands/pkg/test_install.py
	tests/commands/pkg/test_uninstall.py
	tests/commands/pkg/test_update.py
	tests/misc/ino2cpp/test_ino2cpp.py
	tests/test_maintenance.py
	tests/test_misc.py
)

EPYTEST_DESELECT=(
	# Requires network access
	tests/misc/test_maintenance.py::test_check_pio_upgrade
	tests/misc/test_misc.py::test_ping_internet_ips
	tests/misc/test_misc.py::test_api_cache
)

distutils_enable_tests pytest

src_prepare() {
	# Allow newer versions of zeroconf, Bug #831181.
	# Also wsproto.
	# ... and semantic_version, bug #853247.
	sed \
		-e '/zeroconf/s/<[0-9.*]*//' \
		-e '/wsproto/s/==.*/"/' \
		-e '/semantic_version/s/==[0-9.*]*//' \
		-i setup.py || die

	default
}

python_test() {
	epytest -k "not skip_ci"
}

src_install() {
	distutils-r1_src_install
	udev_dorules scripts/99-platformio-udev.rules
}

pkg_postinst() {
	udev_reload
}

pkg_postrm() {
	udev_reload
}