# Contributor: Kaarle Ritvanen # Maintainer: Drew DeVault pkgname=py-factory-boy _pkgname=factory_boy pkgver=2.11.1 pkgrel=3 pkgdesc="A verstile test fixtures replacement based on thoughtbot's factory_girl for Ruby" url=https://github.com/rbarrois/factory_boy arch=noarch license=MIT _py2_deps="py2-faker py2-six" _py2_deps="py3-faker py3-six" makedepends="$_py2_deps $_py3_deps py2-setuptools py3-setuptools" checkdepends=" py2-mock py3-mock py2-django py3-django py2-sqlalchemy py3-sqlalchemy " subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3" source="$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/$_pkgname/archive/$pkgver.tar.gz python-3.7.patch" builddir=$srcdir/$_pkgname-$pkgver prepare() { cd "$builddir" default_prepare # mongodb is not supported by Alpine Linux rm factory/mongoengine.py sed -i factory/__init__.py -e 's/from . import mongoengine//g' rm tests/test_mongoengine.py sed -i tests/__init__.py -e 's/from .test_mongoengine.*//g' cp -r "$builddir" "$builddir"-py3 } build() { cd "$builddir" python2 setup.py build cd "$builddir"-py3 python3 setup.py build } check() { cd "$builddir" # sqlalchemy deprecation test fails on Python 2; benign failure #python2 setup.py test cd "$builddir"-py3 python3 setup.py test } package() { mkdir -p "$pkgdir" } _py2() { replaces="py-factory-boy" depends="$_py2_deps" cd "$builddir" _py python2 } _py3() { depends="$_py3_deps" cd "$builddir"-py3 _py python3 } _py() { python="$1" pkgdesc="$pkgdesc (for $python)" depends="$depends $python" install_if="$pkgname=$pkgver-r$pkgrel $python" $python setup.py install --prefix=/usr --root="$subpkgdir" } sha512sums="f2a0856212bb47f29007a9ec52af129c63a0546f3d4eb733ce42eb285cad4eecabfd917badb18b723e2ee653c09422328413a3eb38b1cad53e4e538a7baffbc2 py-factory-boy-2.11.1.tar.gz 6397bdd38484b8727bc88066f6da1721faa6d3717c72af54d53c62b947798e7705f74f82c3355e06dc89e2e7b32edabd0a099d80e515adb3733417c73b0eaadd python-3.7.patch"