| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
PYTHON_COMPAT=( python3_{12..14} )
|
|
6 |
PYTHON_COMPAT=( python3_{12..15} )
|
| 7 |
7 |
DISTUTILS_USE_PEP517=setuptools
|
| 8 |
8 |
PYPI_VERIFY_REPO=https://github.com/linode/linode-cli
|
| 9 |
|
inherit distutils-r1 pypi shell-completion
|
|
9 |
inherit distutils-r1 shell-completion
|
|
10 |
|
|
11 |
OPENAPI_TAG=20261028
|
| 10 |
12 |
|
| 11 |
13 |
DESCRIPTION="Official command-line interface for interacting with the Linode API"
|
| 12 |
14 |
HOMEPAGE="https://github.com/linode/linode-cli https://www.linode.com/"
|
|
15 |
SRC_URI="
|
|
16 |
https://github.com/linode/linode-cli/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz
|
|
17 |
https://github.com/linode/linode-api-openapi/archive/release-${OPENAPI_TAG}.tar.gz
|
|
18 |
-> linode-api-openapi-${OPENAPI_TAG}.gh.tar.gz
|
|
19 |
"
|
| 13 |
20 |
|
| 14 |
21 |
LICENSE="BSD"
|
| 15 |
22 |
SLOT="0"
|
| 16 |
23 |
KEYWORDS="~amd64"
|
| 17 |
24 |
|
| 18 |
|
# Tests require network, a linode account and an API key.
|
| 19 |
|
# WARNING: tests will incur costs and will wipe the account.
|
| 20 |
|
RESTRICT="test"
|
| 21 |
|
|
| 22 |
25 |
RDEPEND="
|
| 23 |
26 |
>=dev-python/boto3-1.36[${PYTHON_USEDEP}]
|
| 24 |
27 |
>=dev-python/linode-metadata-0.3[${PYTHON_USEDEP}]
|
| ... | ... | |
| 31 |
34 |
<dev-python/urllib3-3[${PYTHON_USEDEP}]
|
| 32 |
35 |
"
|
| 33 |
36 |
|
|
37 |
EPYTEST_PLUGINS=( pytest-mock requests-mock )
|
|
38 |
distutils_enable_tests pytest
|
|
39 |
|
|
40 |
EPYTEST_DESELECT=(
|
|
41 |
# needs network
|
|
42 |
tests/unit/test_plugin_kubeconfig.py::test_nonexisting_id
|
|
43 |
)
|
|
44 |
|
|
45 |
python_prepare_all() {
|
|
46 |
# Remove tests that require networking and a valid linode api key
|
|
47 |
rm -r tests/integration || die
|
|
48 |
|
|
49 |
distutils-r1_python_prepare_all
|
|
50 |
}
|
|
51 |
|
|
52 |
# We need to build the data-3 file from the openapi spec
|
|
53 |
python_configure_all() {
|
|
54 |
sed "s/python3 /${EPYTHON} /" -i Makefile || die
|
|
55 |
emake create-version bake \
|
|
56 |
SPEC="${WORKDIR}"/linode-api-openapi-release-${OPENAPI_TAG}/openapi.json \
|
|
57 |
LINODE_CLI_VERSION=${PV}
|
|
58 |
}
|
|
59 |
|
|
60 |
python_test() {
|
|
61 |
# LINODE_CLI_TOKEN needs to be defined for the tests to run; define it to something invalid
|
|
62 |
# and skip the tests that require it
|
|
63 |
LINODE_CLI_TOKEN=invalid epytest
|
|
64 |
}
|
|
65 |
|
| 34 |
66 |
python_install_all() {
|
| 35 |
67 |
distutils-r1_python_install_all
|
| 36 |
68 |
|