blob: c6d1b1d50841274a1155541cb6c4695be27dc57f [file] [log] [blame]
# Contributor: Frederic Wang <fred.wang@free.fr>
_realname=pytest
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=6.2.4
pkgrel=1
pkgdesc='simple powerful testing with Python (mingw-w64)'
url='https://pytest.org/'
license=('MIT')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
depends=("${MINGW_PACKAGE_PREFIX}-python-atomicwrites"
"${MINGW_PACKAGE_PREFIX}-python-attrs"
"${MINGW_PACKAGE_PREFIX}-python-colorama"
"${MINGW_PACKAGE_PREFIX}-python-iniconfig"
"${MINGW_PACKAGE_PREFIX}-python-packaging"
"${MINGW_PACKAGE_PREFIX}-python-pluggy"
"${MINGW_PACKAGE_PREFIX}-python-py"
"${MINGW_PACKAGE_PREFIX}-python-toml")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools-scm")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-hypothesis"
"${MINGW_PACKAGE_PREFIX}-python-mock"
"${MINGW_PACKAGE_PREFIX}-python-nose"
"${MINGW_PACKAGE_PREFIX}-python-pytest-xdist"
"${MINGW_PACKAGE_PREFIX}-python-requests"
"${MINGW_PACKAGE_PREFIX}-python-tox"
"${MINGW_PACKAGE_PREFIX}-python-yaml")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/pytest-dev/pytest/archive/${pkgver}.tar.gz")
sha256sums=('c83540d271f7d58d601f97f9f2dbe858e92d9bea5ff7867110e5505c12358406')
prepare() {
sed -i "s/'_pytest.vendored_packages'//" ${_realname}-${pkgver}/setup.py
sed -i 's/assert numentries == 0/assert numentries == 26/' ${_realname}-${pkgver}/testing/python/collect.py
export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
rm -rf python-build-${CARCH}
cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}
# Note that build() is sometimes skipped because it's done in
# the packages setup.py install for simplicity if you can do so.
# but sometimes, you want to do a check before install which would
# also trigger the build.
build() {
cd "${srcdir}/python-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py build
}
check() {
cd "${srcdir}/python-build-${CARCH}"
# Python3: 1 failed, 2361 passed, 88 skipped, 12 xfailed, 1 warnings
MSYSTEM= PYTHONPATH="$(pwd)/build/lib" \
${MINGW_PREFIX}/bin/python src/pytest.py || warning "Test failed"
}
package() {
cd "${srcdir}/python-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING"
# fix python command in files
for _ff in ${pkgdir}${MINGW_PREFIX}/bin/*.py; do
sed -e '1 { s/^#!.*$// }' -i ${_ff}
done
}