desktop/python-mock/PKGBUILD

52 lines
1.5 KiB
Bash

# Maintainer: Manuel 'UtG' <utg.chakra.linux[at]gmail[dot]com>
pkgbase=python-mock
pkgname=(python2-mock python3-mock)
pkgver=1.3.0
pkgrel=2
pkgdesc='Mocking and Patching Library for Testing'
url='http://www.voidspace.org.uk/python/mock/'
makedepends=('python3-setuptools' 'python2-setuptools')
checkdepends=('python3-nose' 'python2-nose' 'python3-pbr' 'python3-six' 'git')
license=('BSD')
arch=('any')
source=("http://pypi.python.org/packages/source/m/mock/mock-$pkgver.tar.gz")
md5sums=('73ee8a4afb3ff4da1b4afa287f39fdeb')
build() {
cd "$srcdir"
cp -rf "mock-$pkgver" "mock2-$pkgver"
cd "$srcdir/mock-$pkgver"
python3 setup.py build
cd "$srcdir/mock2-$pkgver"
python2 setup.py build
}
check() {
cd "$srcdir/mock2-$pkgver/"
sed -i 's/unittest2/unittest/g' mock/tests/*.py
echo 'python tests'
python3 -m unittest discover
# Does not run because of self.assertRaisesRegex() usage in unitests, which is self.assertRaisesRegexp() in Python 2.7
#echo 'python2 tests'
#python2 -m unittest discover
}
package_python3-mock() {
depends=('python3' 'python3-six' 'python3-pbr')
cd "$srcdir/mock-$pkgver"
python3 setup.py install --optimize=1 --root="$pkgdir"
install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
package_python2-mock() {
depends=('python2' 'python2-six' 'python2-pbr' 'python2-funcsigs')
cd "$srcdir/mock2-$pkgver"
python2 setup.py install --optimize=1 --root="$pkgdir"
install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}