Mail archive
alpine-aports

[alpine-aports] [PATCH 7/7] main/py-factory-boy: fix depends

From: Drew DeVault <sir_at_cmpwn.com>
Date: Wed, 6 Mar 2019 14:01:28 -0700

Also modernizes the APKBUILD
---
 main/py-factory-boy/APKBUILD | 67 +++++++++++++++++++++++++++---------
 1 file changed, 50 insertions(+), 17 deletions(-)
diff --git a/main/py-factory-boy/APKBUILD b/main/py-factory-boy/APKBUILD
index cb810161b2..24b0876c58 100644
--- a/main/py-factory-boy/APKBUILD
+++ b/main/py-factory-boy/APKBUILD
_at_@ -1,35 +1,68 @@
 # Contributor: Kaarle Ritvanen <kaarle.ritvanen_at_datakunkku.fi>
+# Contributor: Drew DeVault <sir_at_cmpwn.com>
 # Maintainer: Kaarle Ritvanen <kaarle.ritvanen_at_datakunkku.fi>
 pkgname=py-factory-boy
+_pkgname=factory_boy
 pkgver=2.11.1
-pkgrel=0
+pkgrel=1
 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
-depends=
-makedepends=py-setuptools
-source="https://files.pythonhosted.org/packages/source/f/factory_boy/factory_boy-$pkgver.tar.gz"
+depends="py-faker py-six"
+makedepends="py-setuptools"
+checkdepends="py-mock py-django py-sqlalchemy"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+source="$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/$_pkgname/archive/$pkgver.tar.gz"
+builddir=$srcdir/$_pkgname-$pkgver
 
-_builddir=$srcdir/factory_boy-$pkgver
 prepare() {
-	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
+	cd "$builddir"
+	# 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"
-	./setup.py 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() {
-	cd "$_builddir"
-	./setup.py install --root "$pkgdir"
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	replaces="py-factory-boy"
+	depends="py-six"
+	cd "$builddir"
+	_py python2
+}
+
+_py3() {
+	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="6c1b6c759d2a68ff4142241f7f26cd1a79b68d31f7e27b4772a242d9cefe79a3bdad35c6bdf1f6446815cd16d6b62c775262a4b75d76217a9152cca7677b6157  factory_boy-2.11.1.tar.gz"
+sha512sums="f2a0856212bb47f29007a9ec52af129c63a0546f3d4eb733ce42eb285cad4eecabfd917badb18b723e2ee653c09422328413a3eb38b1cad53e4e538a7baffbc2  py-factory-boy-2.11.1.tar.gz"
-- 
2.21.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Mar 06 2019 - 14:01:28 UTC