summaryrefslogtreecommitdiff
path: root/www-apps/byparr/byparr-3.0.4.ebuild
blob: 5eee7b88f417eaf2fdcc4c7dfe690992eb003ad5 (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
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=no
PYTHON_COMPAT=( python3_{13..14} )

inherit distutils-r1 systemd

DESCRIPTION="Proxy server to bypass captchas"
HOMEPAGE="https://github.com/ThePhaseless/Byparr"
SRC_URI="https://github.com/ThePhaseless/Byparr/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

S="${WORKDIR}/Byparr-${PV}"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	acct-group/byparr
	acct-user/byparr

	$(python_gen_cond_dep '
		dev-python/fastapi[${PYTHON_USEDEP}]
		dev-python/invisible-playwright[${PYTHON_USEDEP}]
		dev-python/playwright-captcha[${PYTHON_USEDEP}]
		dev-python/playwright[${PYTHON_USEDEP}]
		dev-python/pydantic-settings[${PYTHON_USEDEP}]
		dev-python/pydantic[${PYTHON_USEDEP}]
		dev-python/trafilatura[${PYTHON_USEDEP}]
		dev-python/uvicorn[${PYTHON_USEDEP}]
	')
"
BDEPEND="
	test? (
		$(python_gen_cond_dep '
			dev-python/httpx2[${PYTHON_USEDEP}]
			dev-python/starlette[${PYTHON_USEDEP}]
		')
	)
"

EPYTEST_DESELECT=(
	"tests/main_test.py::test_bypass"
	"tests/main_test.py::test_health_check"
	"tests/main_test.py::test_json_api"
	"tests/main_test.py::test_pdf_handling"
	"tests/owui_test.py::test_networkidle_timeout_still_extracts_content"
	"tests/owui_test.py::test_owui_load_accepts_valid_key"
	"tests/owui_test.py::test_owui_load_basic"
	"tests/owui_test.py::test_owui_load_invalid_url_graceful"
	"tests/owui_test.py::test_owui_load_multiple_urls"
)

EPYTEST_PLUGINS=( pytest-asyncio )
distutils_enable_tests pytest

src_prepare() {
	# Let's turn `src` into a proper Python module
	find . \
		-type f -name "*.py" \
		-exec sed 's/from src/from byparr/g' -i {} + || die
	sed 's/src\./byparr\./g' -i tests/owui_test.py || die
	mv src byparr || die

	sed -e '1i #!/usr/bin/env python' -i main.py || die

	distutils-r1_src_prepare
}

python_install() {
	python_domodule "${PN}"
	python_newscript main.py "${PN}"

	systemd_dounit "${FILESDIR}/byparr.service"
}