# Template file for 'python-pytest'
pkgname=python-pytest
version=3.6.0
revision=2
noarch=yes
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"
checkdepends="python3-atomicwrites python3-hypothesis python3-more-itertools
 python3-pluggy python3-py python3-atomicwrites"
short_desc="Simple powerful testing with Python2"
maintainer="maxice8 <thinkabit.ukim@gmail.com>"
license="MIT"
homepage="https://docs.pytest.org/en/latest/"
distfiles="${PYPI_SITE}/p/pytest/pytest-${version}.tar.gz"
checksum=39555d023af3200d004d09e51b4dd9fdd828baa863cded3fd6ba2f29f757ae2d
alternatives="
 pytest:pytest:/usr/bin/pytest2
 pytest:py.test:/usr/bin/py.test2"

pre_build() {
	sed -i setup.py \
		-e '/setup_requires=/d' \
		-e '/use_scm_version/,+2d' \
		-e "/name=/ a\
		version='${version}',"
}
do_check() {
	python3 setup.py test
}
post_install() {
	vlicense LICENSE
}

python3-pytest_package() {
	noarch=yes
	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"
	pkg_install() {
		vmove "usr/bin/*3"
		vmove "usr/lib/python3*"
		vlicense LICENSE
	}
}
