Files
MINGW-packages/mingw-w64-python-subunit/PKGBUILD
2019-12-16 15:10:10 +03:00

59 lines
2.4 KiB
Bash

# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=subunit
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.3.0
pkgrel=4
pkgdesc="Python implementation of subunit test streaming protocol (mingw-w64)"
arch=('any')
url='https://launchpad.net/subunit'
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-python3-extras"
"${MINGW_PACKAGE_PREFIX}-python3-testtools")
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-fixtures"
"${MINGW_PACKAGE_PREFIX}-python3-hypothesis"
"${MINGW_PACKAGE_PREFIX}-python3-testscenarios")
options=('staticlibs' 'strip' '!debug')
source=("https://pypi.io/packages/source/p/python-subunit/python-subunit-${pkgver}.tar.gz")
sha512sums=('387c9ce8ed679d8998d33c7a295412e4f9de46b8dccdfab92eb82d8c4290958760b6c9bd99d50abd0836e4556c1b0c0132fc01e16801a3113844ab1bf28cf962')
# Helper macros to help make tasks easier #
prepare() {
cd "${srcdir}"
sed -i 's|import unittest2 as unittest|import unittest|' python-subunit-${pkgver}/python/subunit/tests/test_test_protocol.py
rm -rf python3-build-${CARCH} | true
cp -r "python-${_realname}-${pkgver}" "python3-build-${CARCH}"
# Set version for setuptools_scm
export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}
build() {
msg "Python 3 build for ${CARCH}"
cd "${srcdir}/python3-build-${CARCH}"
${MINGW_PREFIX}/bin/python3 setup.py build
}
check() {
msg "Python 3 test for ${CARCH}"
cd "${srcdir}/python3-build-${CARCH}"
PYTHONPATH="$PWD/build/lib:$PYTHONPATH" ${MINGW_PREFIX}/bin/python3 -m testtools.run subunit.test_suite || warning "Tests failed"
}
package() {
cd "${srcdir}/python3-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
#fix so the correct interpretter is used
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
for name in subunit-1to2 subunit-2to1 subunit-filter subunit-ls subunit-notify subunit-output subunit-stats subunit-tags subunit2csv subunit2gtk subunit2junitxml subunit2pyunit tap2subunit subunit2disk; do
sed -e "s|${PREFIX_WIN}/bin/python3.exe|${MINGW_PREFIX}/bin/python3.exe|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/$name
done
}