Subject: [alpine-aports] [PATCH 0/7] clean up py-factory-boy

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:21 -0700

This adds a check() function & fixes missing dependencies.

William, Kaarle, if you want some help maintaining py-sqlalchemy or
py-factory-boy respectively, I'd be happy to adopt them.

Drew DeVault (7):
  main/py-email-validator: new APKBUILD
  main/py-text-unidecode: new APKBUILD
  main/py-ukcodeparser: new APKBUILD
  main/py-faker: new APKBUILD
  community/py-sqlalchemy: update to 1.3.0
  main/py-sqlalchemy: move from community
  main/py-factory-boy: fix depends

 main/py-email-validator/APKBUILD           | 58 +++++++++++++++++++
 main/py-factory-boy/APKBUILD               | 67 ++++++++++++++++------
 main/py-faker/APKBUILD                     | 64 +++++++++++++++++++++
 {community => main}/py-sqlalchemy/APKBUILD | 45 ++++++++++-----
 main/py-text-unidecode/APKBUILD            | 57 ++++++++++++++++++
 main/py-ukpostcodeparser/APKBUILD          | 57 ++++++++++++++++++
 6 files changed, 316 insertions(+), 32 deletions(-)
 create mode 100644 main/py-email-validator/APKBUILD
 create mode 100644 main/py-faker/APKBUILD
 rename {community => main}/py-sqlalchemy/APKBUILD (63%)
 create mode 100644 main/py-text-unidecode/APKBUILD
 create mode 100644 main/py-ukpostcodeparser/APKBUILD

-- 
2.21.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:27 -0700

---
 {community => main}/py-sqlalchemy/APKBUILD | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {community => main}/py-sqlalchemy/APKBUILD (100%)

diff --git a/community/py-sqlalchemy/APKBUILD b/main/py-sqlalchemy/APKBUILD
similarity index 100%
rename from community/py-sqlalchemy/APKBUILD
rename to main/py-sqlalchemy/APKBUILD
-- 
2.21.0

---

---

From: Drew DeVault <[email-masked]>
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
@@ -1,35 +1,68 @@
 # Contributor: Kaarle Ritvanen <[email-masked]>
+# Contributor: Drew DeVault <[email-masked]>
 # Maintainer: Kaarle Ritvanen <[email-masked]>
 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

---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:22 -0700

---
 main/py-email-validator/APKBUILD | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 main/py-email-validator/APKBUILD

diff --git a/main/py-email-validator/APKBUILD b/main/py-email-validator/APKBUILD
new file mode 100644
index 0000000000..f31b583bc6
--- /dev/null
+++ b/main/py-email-validator/APKBUILD
@@ -0,0 +1,58 @@
+# Maintainer: Drew DeVault <[email-masked]>
+pkgname=py-email-validator
+_pkgname=python-email-validator
+pkgver=1.0.3
+pkgrel=0
+pkgdesc="A robust email syntax and deliverability validation library"
+url=https://github.com/JoshData/python-email-validator
+arch=noarch
+license="CC0-1.0"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+depends="py-dnspython py-idna"
+makedepends="py-setuptools"
+source="$pkgname-$pkgver.tar.gz::https://github.com/JoshData/$_pkgname/archive/v$pkgver.tar.gz"
+builddir=$srcdir/$_pkgname-$pkgver
+
+prepare() {
+	cp -r "$builddir" "$builddir"-py3
+}
+
+build() {
+	cd "$builddir"
+	python2 setup.py build
+	cd "$builddir"-py3
+	python3 setup.py build
+}
+
+check() {
+	cd "$builddir"
+	python2 -c "import email_validator; email_validator.main()" \
+		--tests < test_pass.txt
+	cd "$builddir"-py3
+	python3 -c "import email_validator; email_validator.main()" \
+		--tests < test_pass.txt
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	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="1e816fdaa796aa92963f0fd90c8b6d111c6484a45416365095d08adc9243a7f8c6a90fb07df9b2e60c664f9b756252d6589baf137f5e0e60833d8759363fdc26  py-email-validator-1.0.3.tar.gz"
-- 
2.21.0

---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:24 -0700

---
 main/py-ukpostcodeparser/APKBUILD | 57 +++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 main/py-ukpostcodeparser/APKBUILD

diff --git a/main/py-ukpostcodeparser/APKBUILD b/main/py-ukpostcodeparser/APKBUILD
new file mode 100644
index 0000000000..6cd72d4adb
--- /dev/null
+++ b/main/py-ukpostcodeparser/APKBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Drew DeVault <[email-masked]>
+pkgname=py-ukpostcodeparser
+_pkgname=ukpostcodeparser
+pkgver=1.1.2
+pkgrel=0
+pkgdesc="UK Postcode parser"
+url=https://github.com/hamstah/ukpostcodeparser
+arch=noarch
+license=MIT
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+makedepends="py-setuptools"
+source="$pkgname-$pkgver.tar.gz::https://github.com/hamstah/$_pkgname/archive/v$pkgver.tar.gz"
+builddir=$srcdir/$_pkgname-$pkgver
+# tests broken upstream: https://github.com/hamstah/ukpostcodeparser/issues/8
+options="!check"
+
+prepare() {
+	cp -r "$builddir" "$builddir"-py3
+}
+
+build() {
+	cd "$builddir"
+	python2 setup.py build
+	cd "$builddir"-py3
+	python3 setup.py build
+}
+
+check() {
+	cd "$builddir"
+	python2 setup.py test
+	cd "$builddir"-py3
+	python3 setup.py test
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	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="8113522b728c095f937a9f53f21c369130e3e63c4fc3546dbea4ad1c53648742fb0e766b1254c76ee65d69dec585f1a90caa7d39ca540de1765ff5f989a702de  py-ukpostcodeparser-1.1.2.tar.gz"
-- 
2.21.0

---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:25 -0700

---
 main/py-faker/APKBUILD | 64 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 main/py-faker/APKBUILD

diff --git a/main/py-faker/APKBUILD b/main/py-faker/APKBUILD
new file mode 100644
index 0000000000..51bff43b97
--- /dev/null
+++ b/main/py-faker/APKBUILD
@@ -0,0 +1,64 @@
+# Maintainer: Drew DeVault <[email-masked]>
+pkgname=py-faker
+_pkgname=Faker
+pkgver=1.0.2
+pkgrel=0
+pkgdesc="Python package that generates fake data for you"
+url=https://faker.readthedocs.io/en/master/
+arch=noarch
+license=MIT
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+depends="py-dateutil py-six py-text-unidecode"
+makedepends="py-setuptools"
+checkdepends="
+	py-email-validator py-ukpostcodeparser py-mock pytest py-more-itertools
+	py2-ipaddress
+"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+builddir=$srcdir/$_pkgname-$pkgver
+
+prepare() {
+	cd "$builddir"
+	# They erroneously require a specific version of pytest
+	sed -i setup.py -e 's/ *"pytest>=.*//g'
+	cp -r "$builddir" "$builddir"-py3
+}
+
+build() {
+	cd "$builddir"
+	python2 setup.py build
+	cd "$builddir"-py3
+	python3 setup.py build
+}
+
+check() {
+	cd "$builddir"
+	python2 setup.py test
+	cd "$builddir"-py3
+	python3 setup.py test
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	cd "$builddir"
+	depends="$depends py2-ipaddress"
+	_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="cd484d2ce244fab0d47b2b4fe541f050f2400d2a8291589ed5ace4a664ecc264294e7f994fb4a12e5f082ac67f1c3bc2f6090fcea5f57cbc7469dfe7195a99b7  Faker-1.0.2.tar.gz"
-- 
2.21.0

---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:23 -0700

---
 main/py-text-unidecode/APKBUILD | 57 +++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 main/py-text-unidecode/APKBUILD

diff --git a/main/py-text-unidecode/APKBUILD b/main/py-text-unidecode/APKBUILD
new file mode 100644
index 0000000000..58c3900cc9
--- /dev/null
+++ b/main/py-text-unidecode/APKBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Drew DeVault <[email-masked]>
+pkgname=py-text-unidecode
+_pkgname=text-unidecode
+pkgver=1.2
+pkgrel=0
+pkgdesc="The most basic Text::Unidecode port"
+url=https://github.com/kmike/text-unidecode/
+arch=noarch
+license="Artistic-1.0-cl8"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+makedepends="py-setuptools"
+checkdepends="pytest"
+source="$pkgname-$pkgver.tar.gz::https://github.com/kmike/$_pkgname/archive/$pkgver.tar.gz"
+builddir=$srcdir/$_pkgname-$pkgver
+
+prepare() {
+	cd "$builddir"
+	cp -r "$builddir" "$builddir"-py3
+}
+
+build() {
+	cd "$builddir"
+	python2 setup.py build
+	cd "$builddir"-py3
+	python3 setup.py build
+}
+
+check() {
+	cd "$builddir"
+	PYTHONPATH=src pytest-2
+	cd "$builddir"-py3
+	PYTHONPATH=src pytest-3
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	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="ce4bd80f8343ebca031a39f1fbe802cd86e3535a67d5e16f8a7f32442ab334e4e5e4d1cf74e8a55ef265765c879bfde87beffd31ff988efff1947f7c883694f9  py-text-unidecode-1.2.tar.gz"
-- 
2.21.0

---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 6 Mar 2019 14:01:26 -0700

Also cleans up and modernizes the APKBUILD
---
 community/py-sqlalchemy/APKBUILD | 45 +++++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/community/py-sqlalchemy/APKBUILD b/community/py-sqlalchemy/APKBUILD
index 7679ed0a26..9ae9c77dcb 100644
--- a/community/py-sqlalchemy/APKBUILD
+++ b/community/py-sqlalchemy/APKBUILD
@@ -1,46 +1,61 @@
 # Contributor: William Pitcock <[email-masked]>
+# Contributor: Drew DeVault <[email-masked]>
 # Maintainer: William Pitcock <[email-masked]>
 pkgname=py-sqlalchemy
 _pkgname=SQLAlchemy
-pkgver=1.2.14
+pkgver=1.3.0
 pkgrel=0
 pkgdesc="An object relational mapper for Python"
 url="https://pypi.python.org/pypi/SQLAlchemy"
 arch="all"
 license="MIT"
-depends=""
 makedepends="python2-dev py-setuptools python3-dev"
+checkdepends="pytest py-mock"
 subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
 source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
 builddir="$srcdir/$_pkgname-$pkgver"
 
-build() {
+prepare() {
 	cd "$builddir"
-	python2 setup.py build || return 1
-	python3 setup.py build || return 1
+	sed -i setup.py -e 's/ *"pytest-xdist",//g'
+	cp -r "$builddir" "$builddir"-py3
 }
 
-package() {
-	mkdir -p "$pkgdir"
+build() {
+	cd "$builddir"
+	python2 setup.py build
+	cd "$builddir"-py3
+	python3 setup.py build
 }
 
-_py() {
-	local python="$1"
-	pkgdesc="$pkgdesc ${python:6:1}"
-	depends="$depends $python"
-	install_if="$pkgname=$pkgver-r$pkgrel $python"
-
+check() {
 	cd "$builddir"
-	$python setup.py install --prefix=/usr --root="$subpkgdir"
+	pytest-2
+	cd "$builddir"-py3
+	pytest-3
+}
+
+package() {
+	mkdir -p "$pkgdir"
 }
 
 _py2() {
+	cd "$builddir"
 	replaces="$pkgname"
 	_py python2
 }
 
 _py3() {
+	cd "$builddir"
 	_py python3
 }
 
-sha512sums="f6b89029180bc6f3e35bc17a1d80c111f6ce05f2f799bbdfee00c961e83aa2f95cbb363c85a5f97c18d5ff0aa1408c164621474cd6ddf8e63dd88da35de69539  SQLAlchemy-1.2.14.tar.gz"
+_py() {
+	local python="$1"
+	pkgdesc="$pkgdesc ${python:6:1}"
+	depends="$depends $python"
+	install_if="$pkgname=$pkgver-r$pkgrel $python"
+	$python setup.py install --prefix=/usr --root="$subpkgdir"
+}
+
+sha512sums="031c912dc8830bab70ebb48b253d47ef949818a9a49f9b8d38a2daed21dd27b295182641158578c4a1bfe4bf065968824430b4f4bf949ffdacb12bb99dae9119  SQLAlchemy-1.3.0.tar.gz"
-- 
2.21.0

---