# Template file for 'deluge'
pkgname=deluge
version=2.0.3
revision=14
build_style=python3-module
# TODO package python3-slimit to minify javascript
hostmakedepends="intltool python3-setuptools python3-wheel"
depends="python3-setuptools python3-chardet python3-Twisted python3-Mako
 python3-xdg python3-rencode python3-setproctitle libtorrent-rasterbar-python3
 python3-Pillow"
checkdepends="python3-pytest $depends"
short_desc="Fully-featured cross-platform BitTorrent client"
maintainer="Alexey Rochev <equeim@gmail.com>"
license="GPL-3.0-or-later"
homepage="https://deluge-torrent.org/"
distfiles="https://ftp.osuosl.org/pub/deluge/source/2.0/deluge-${version}.tar.xz"
checksum=7e7ae8e6ca2a2bf0d487227cecf81e27332f0b92b567cc2bda38e47d859da891

system_accounts="deluge"
deluge_homedir="/var/lib/deluge"

make_dirs="/var/lib/deluge 0755 deluge deluge"

post_install() {
	vsv deluged
}

do_check() {
	python3 -m pytest || : # fails
}

deluge-gtk_package() {
	replaces="deluge<1.3.14_1"
	short_desc+=" - GTK+ frontend"
	depends="${sourcepkg}-${version}_${revision} python3-gobject"
	pkg_install() {
		vmove usr/bin/deluge
		vmove usr/bin/deluge-gtk
		vmove ${py3_sitelib}/deluge/ui/gtk3
		vmove usr/share/applications
		vmove usr/share/icons
		vmove usr/share/man/man1/deluge.1
		vmove usr/share/man/man1/deluge-gtk.1
	}
}
deluge-web_package() {
	replaces="deluge<1.3.14_1"
	short_desc+=" - Web frontend"
	depends="${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/bin/deluge-web
		vmove ${py3_sitelib}/deluge/ui/web
		vmove usr/share/man/man1/deluge-web.1
		vsv deluge-web
	}
}
