blob: 072731b07b80b2532084cf854dac311e6ab00819 [file] [log] [blame] [edit]
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=testtools
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=2.4.0
pkgrel=1
pkgdesc="Extensions to the Python standard library unit testing framework (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/testing-cabal/testtools'
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-python-pbr"
"${MINGW_PACKAGE_PREFIX}-python-extras"
"${MINGW_PACKAGE_PREFIX}-python-fixtures"
"${MINGW_PACKAGE_PREFIX}-python-pyrsistent"
"${MINGW_PACKAGE_PREFIX}-python-mimeparse")
makedepends=('git'
"${MINGW_PACKAGE_PREFIX}-python3-setuptools")
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/testing-cabal/testtools/archive/${pkgver}.tar.gz")
sha256sums=('8b152cd95244fedad2e7bcb824d172978b12533317c827ae7845a8c0dbb6dd0c')
prepare() {
rm -rf python-build-${CARCH} | true
cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
# These are for python 2.x and old python 3.x only
sed -i 's|unittest2|unittest|' python-build-${CARCH}/testtools/tests/test_run.py \
python-build-${CARCH}/testtools/tests/test_testsuite.py \
python-build-${CARCH}/testtools/tests/twistedsupport/test_matchers.py \
python-build-${CARCH}/testtools/tests/twistedsupport/test_deferred.py \
python-build-${CARCH}/testtools/tests/twistedsupport/test_runtest.py
sed -i '/unittest2>=1.0.0/d' python-build-${CARCH}/requirements.txt
sed -i 's|import linecache2 as linecache|import linecache|' python-build-${CARCH}/testtools/tests/test_compat.py
sed -i "s|traceback = try_import('traceback2')|import traceback|" python-build-${CARCH}/testtools/content.py
sed -i '/traceback2/d' python-build-${CARCH}/requirements.txt
# Set version for setuptools_scm
export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
export PBR_VERSION=${pkgver}
}
build() {
cd "${srcdir}/python-build-${CARCH}"
${MINGW_PREFIX}/bin/python setup.py build
}
check() {
cd "${srcdir}/python-build-${CARCH}"
${MINGW_PREFIX}/bin/python -m testtools.run testtools.tests.test_suite
}
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}/LICENSE"
}