# Template file for 'hydrus'
pkgname=hydrus
version=573
revision=3
pycompile_dirs="usr/lib/hydrus"
hostmakedepends="python3"
depends="python3 libopencv-python3 python3-BeautifulSoup4 python3-yaml
 python3-lz4 python3-numpy python3-Twisted python3-Pillow python3-pysocks
 python3-psutil python3-send2trash python3-html5lib python3-requests
 python3-QtPy noto-fonts-emoji python3-mpv python3-service_identity fmt ffmpeg
 miniupnpc desktop-file-utils python3-cloudscraper python3-openssl
 python3-packaging"
short_desc="Danbooru-like image tagging and searching system for the desktop"
maintainer="Eloi Torrents <eloitor@duck.com>"
license="WTFPL"
homepage="https://hydrusnetwork.github.io/hydrus/"
changelog="https://raw.githubusercontent.com/hydrusnetwork/hydrus/master/docs/changelog.md"
distfiles="https://github.com/hydrusnetwork/hydrus/archive/refs/tags/v${version}.tar.gz"
checksum=80738fcbb67941aaeeddf7e1fe7f0d8f4f28d2286341862a45f970dec8dde1c7
python_version="3"

do_install() {
	vsed -i hydrus/core/HydrusConstants.py -e 's|^LICENSE_PATH.*|LICENSE_PATH = "/usr/share/licenses/hydrus/license.txt"|'

	chmod +x hydrus_server.py hydrus_client.py

	vmkdir usr/lib/hydrus
	rm -r static/build_files
	rm -r static/requirements
	vcopy hydrus usr/lib/hydrus/
	vcopy static usr/lib/hydrus/

	vcopy hydrus_client.py usr/lib/hydrus/
	vcopy hydrus_server.py usr/lib/hydrus/

	vmkdir usr/bin
	ln -sf ../lib/hydrus/hydrus_client.py ${DESTDIR}/usr/bin/hydrus-client
	ln -sf ../lib/hydrus/hydrus_server.py ${DESTDIR}/usr/bin/hydrus-server

	rm -f ${DESTDIR}/usr/lib/hydrus/static/io.github.hydrusnetwork.hydrus.desktop
	vmkdir usr/share/applications
	vinstall static/io.github.hydrusnetwork.hydrus.desktop 644 \
		usr/share/applications

	vlicense COPYING
}
