buku-4.5.ebuild 2.95 KB
Newer Older
1
# Copyright 1999-2021 Gentoo Authors
2 3 4 5
# Distributed under the terms of the GNU General Public License v2

EAPI=7

6
PYTHON_COMPAT=( python3_{6,7,8,9,10} )
7
PYTHON_REQ_USE="sqlite"
8 9 10 11 12 13
DISTUTILS_USE_SETUPTOOLS=rdepend

inherit bash-completion-r1 distutils-r1

DESCRIPTION="Powerful command-line bookmark manager"
HOMEPAGE="https://github.com/jarun/buku"
14
SRC_URI="https://github.com/jarun/${PN}/archive/v$(ver_cut 1-2).tar.gz -> ${P}.tar.gz"
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

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="
	>=dev-python/beautifulsoup-4.6.0[${PYTHON_USEDEP}]
	dev-python/cryptography[${PYTHON_USEDEP}]
	>=dev-python/html5lib-1.0.1[${PYTHON_USEDEP}]
	dev-python/urllib3[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}
	test? (
		dev-python/attrs[${PYTHON_USEDEP}]
		>=dev-python/click-7.0[${PYTHON_USEDEP}]
		dev-python/hypothesis[${PYTHON_USEDEP}]
		>=dev-python/py-1.5.0[${PYTHON_USEDEP}]
		dev-python/pytest[${PYTHON_USEDEP}]
		>=dev-python/pyyaml-4.2[${PYTHON_USEDEP}]
		>=dev-python/vcrpy-4.0.2[${PYTHON_USEDEP}]
	)
"

40 41 42 43
PATCHES=(
	"${FILESDIR}/${P}-hypothesis-fix.patch"
)

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
python_prepare_all() {
	# Remove support for bukuserver - complex depgraph which isn't all
	# sufficiently packaged in Gentoo
	sed -ie '/console_scripts/s/,.*/]/' setup.py || die
	sed -ie 's/.*bukuserver.*//' tests/test_views.py || die
	sed -ie 's/.*flask.*//' tests/test_views.py || die

	distutils-r1_python_prepare_all
}

python_install_all() {
	distutils-r1_python_install_all

	insinto /usr/share/zsh/site-functions
	doins auto-completion/zsh/_*

	newbashcomp auto-completion/bash/buku-completion.bash "${PN}"

	doman buku.1
}

python_test() {
	local skipped_tests=(
		# Disable tests related to bukuserver
68 69 70
		tests/test_setup.py::test_bukuserver_requirement
		tests/test_views.py::test_bmv_create_form
		tests/test_views.py::test_bookmark_model_view
71 72
		tests/test_views.py::test_load_firefox_database
		tests/test_views.py::test_tag_model_view_get_list
73
		tests/test_views.py::test_tag_model_view_get_list_empty_db
74 75 76 77

		# Broken with network-sandbox
		tests/test_buku.py::test_network_handler_with_url
		tests/test_bukuDb.py::TestBukuDb::test_tnyfy_url
78 79
		tests/test_bukuDb.py::test_add_rec_exec_arg
		tests/test_bukuDb.py::test_load_firefox
80 81
		tests/test_bukuDb.py::test_print_db
		tests/test_bukuDb.py::test_print_rec
82
		tests/test_bukuDb.py::test_refreshdb
83

84 85 86
		# Hard to debug sandbox issue - these pass when run outside portage
		# There also appears to be some state issue between these, because
		# skipping one can result in a later one failing.
87
		tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-True-False]
88 89 90
		tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-False-True]
		tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-False-False]
		tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-True-True]
91 92 93 94 95
	)

	# tests/test_server.py is bukuserver tests, ignore it
	pytest -v --ignore tests/test_server.py ${skipped_tests[@]/#/--deselect } || die "Tests failed with ${EPYTHON}"
}