# Template file for 'python-pytest'
pkgname=python-pytest
version=3.7.1
revision=3
archs=noarch
wrksrc="${pkgname/python-//}-${version}"
build_style=python-module
pycompile_module="_pytest pytest.py"
hostmakedepends="python-setuptools python3-setuptools"
depends="python-atomicwrites python-attrs python-funcsigs python-more-itertools
 python-pluggy python-py python-setuptools python-pathlib2"
checkdepends="python3-atomicwrites python3-hypothesis python3-more-itertools
 python3-pluggy python3-py python3-six"
short_desc="Simple powerful testing with Python2"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://docs.pytest.org/en/latest/"
changelog="https://raw.githubusercontent.com/pytest-dev/pytest/master/CHANGELOG.rst"
distfiles="${PYPI_SITE}/p/pytest/pytest-${version}.tar.gz"
checksum=86a8dbf407e437351cef4dba46736e9c5a6e3c3ac71b2e942209748e76ff2086
alternatives="
 pytest:pytest:/usr/bin/pytest2
 pytest:py.test:/usr/bin/py.test2"

pre_build() {
	sed -i setup.py \
		-e '/setup_requires=/d' \
		-e "s|use_scm_version=.*|version=\"${version}\",|"
}

do_check() {
	python3 setup.py test
}

post_install() {
	vlicense LICENSE
}

python3-pytest_package() {
	archs=noarch
	pycompile_module="_pytest pytest.py"
	alternatives="
	 pytest:pytest:/usr/bin/pytest3
	 pytest:py.test:/usr/bin/py.test3"
	short_desc="${short_desc/Python2/Python3}"
	depends="python3-atomicwrites python3-attrs python3-more-itertools
	 python3-pluggy python3-py python3-setuptools python3-six"
	pkg_install() {
		vmove "usr/bin/*3"
		vmove "usr/lib/python3*"
		vlicense LICENSE
	}
}
