# Template file for 'backblaze-b2'
pkgname=backblaze-b2
version=2.1.0
revision=1
wrksrc="b2-${version}"
build_style=python3-module
hostmakedepends="python3-setuptools"
depends="python3-logfury python3-Arrow python3-requests python3-six
 python3-tqdm python-b2sdk"
checkdepends="python3-pytest $depends python3-pyflakes python3-mock
 python3-dateutil python3-nose"
short_desc="Command Line Interface for Backblaze's B2 storage service"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="MIT"
homepage="https://github.com/Backblaze/B2_Command_Line_Tool"
distfiles="${PYPI_SITE}/b/b2/b2-${version}.tar.gz"
checksum=fdae4aa7c88c7981ae68784600cc820ab8fd591a2ca6dc7af5e6b4d1549c2080
replaces="python-b2>=0"
provides="python-b2-${version}_${revision}"

post_patch() {
	# this files is necessary for do_check
	# the files is copied directly from its GitHub's repository
	cp "$FILESDIR/test_b2_command_line.py" "$wrksrc"
}

post_install() {
	# Remove test directory polluting site-packages
	rm -rf ${DESTDIR}/usr/lib/python*/site-packages/test

	# Avoid conflict with Boost's b2 tool
	mv ${DESTDIR}/usr/bin/b2  ${DESTDIR}/usr/bin/backblaze-b2

	vlicense LICENSE
}

do_check() {
	python3 setup.py nosetests
}

python-b2_package() {
	depends="backblaze-b2>=${version}_${revision}"
	build_style=meta
	short_desc+=" - transitional package"
}
