dev-python/cloudflare: minor cleanups

Signed-off-by: Kyle Elbert <kcelbert@gmail.com>
This commit is contained in:
Kyle Elbert
2026-05-17 15:34:18 -05:00
parent 733e0c0069
commit e52fb36be5
2 changed files with 15 additions and 19 deletions

View File

@@ -16,15 +16,15 @@ else
MYPV=$(ver_rs 3 -)
MYPV=${MYPV/beta/beta.}
MYPN="cloudflare-python"
SRC_URI="https://github.com/cloudflare/cloudflare-python/archive/refs/tags/v${MYPV}.tar.gz -> ${P}.gh.tar.gz
SRC_URI="
https://github.com/cloudflare/cloudflare-python/archive/refs/tags/v${MYPV}.tar.gz -> ${MYPN}-${MYPV}.gh.tar.gz
test? ( https://github.com/Phoenix591/${MYPN}/releases/download/${MYPV}/${MYPN}-${MYPV}-prism.tar.gz )"
#Prism archive generated by workflow
# https://github.com/Phoenix591/cloudflare-python/blob/master/.github/workflows/test-tar.yml
S="${WORKDIR}/${MYPN}-${MYPV}"
KEYWORDS="~amd64 ~arm64"
fi
LICENSE="MIT test? ( ISC Apache-2.0 MIT BSD CC0-1.0 0BSD )"
# nodejs module and deps used to test
LICENSE="MIT"
SLOT="0"
RDEPEND=" ${DEPEND}
>=dev-python/httpx-0.23.0[${PYTHON_USEDEP}]
@@ -42,24 +42,21 @@ BDEPEND="test? (
dev-python/dirty-equals[${PYTHON_USEDEP}]
${RDEPEND}
)"
EPYTEST_PLUGINS=( pytest-xdist pytest-asyncio respx )
EPYTEST_PLUGINS=( pytest-asyncio pytest-xdist respx )
EPYTEST_DESELECT=(
tests/test_client.py::TestCloudflare::test_validate_headers
tests/test_client.py::TestAsyncCloudflare::test_validate_headers
)
distutils_enable_tests pytest
RESTRICT+=" !test? ( test )"
DOCS="docs/migration-guides/v5.0.0-migration-guide.md"
DOCS=( docs/migration-guides/v5.0.0-migration-guide.md )
src_unpack() {
unpack "${P}.gh.tar.gz"
unpack "${MYPN}-${MYPV}.gh.tar.gz"
use test && cd "${S}" && unpack "cloudflare-python-${MYPV}-prism.tar.gz"
}
python_test() {
# these 2 tests fail in our sandbox for some reason
local EPYTEST_DESELECT=(
tests/test_client.py::TestCloudflare::test_validate_headers
tests/test_client.py::TestAsyncCloudflare::test_validate_headers )
epytest
}
src_test() {
start_mock
distutils-r1_src_test
@@ -71,9 +68,8 @@ start_mock() {
"cloudflare-spec.yml" >prism.log || die "Failed starting prism" &
echo $! >"${T}/mock.pid" || die
# Wait for server to come online
echo -n "Waiting for mockserver"
einfo "Waiting for mockserver"
while ! grep -q "✖ fatal\|Prism is listening" "prism.log" ; do
echo -n "." || die
sleep 0.5
done
if grep -q "✖ fatal" prism.log; then
@@ -81,13 +77,13 @@ start_mock() {
fi
}
stop_mock() {
kill $(cat "${T}/mock.pid") || die
kill $(<"${T}/mock.pid") || die
}
pkg_postinst() {
if ver_replacing -lt "5.0.0_beta1"; then
elog "Cloudflare 5 has several breaking changes"
elog "See /usr/share/doc/${P}/docs/v5-migration-guide.md"
elog "See /usr/share/doc/${P}/docs/v5.0.0-migration-guide.md"
elog "It also includes a new optional dependency on httpx-aiohttp"
elog "Check the README for details"
fi