desktop/python-mock/PKGBUILD
2017-10-28 20:02:10 +02:00

52 lines
1.6 KiB
Bash

# Maintainer: Manuel 'UtG' <utg.chakra.linux[at]gmail[dot]com>
pkgbase=python-mock
pkgname=(python2-mock python3-mock)
pkgver=2.0.0
pkgrel=1
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' 'python2-pbr' 'python3-six' 'python2-six' 'git')
license=('BSD')
arch=('any')
source=("https://pypi.python.org/packages/0c/53/014354fc93c591ccc4abff12c473ad565a2eb24dcd82490fae33dbf2539f/mock-2.0.0.tar.gz")
md5sums=('0febfafd14330c9dcaa40de2d82d40ad')
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
}