aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-sqlalchemy-migrate/APKBUILD
blob: 0f563e6bb1be7de5ee262e6005fc196d6b57eed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-sqlalchemy-migrate
_pkgname=sqlalchemy-migrate
pkgver=0.11.0
pkgrel=1
pkgdesc="SQLAlchemy Schema Migration Tools"
url="https://github.com/openstack/sqlalchemy-migrate"
arch="noarch"
license="MIT"
depends="py3-${pkgname#py-} py-sqlalchemy py-tempita py-decorator py-sqlparse"
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$pkgname-$pkgver.tar.gz::https://github.com/openstack/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build
	python3 setup.py build
}

package() {
	mkdir -p "$pkgdir"/usr/bin

	local name; for name in migrate migrate-repository; do
		ln -s sqlalchemy-$name-3 "$pkgdir"/usr/bin/sqlalchemy-$name
	done
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	local pyver="${1:6:1}"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"

	cd "$subpkgdir"/usr/bin
	local file; for file in *; do
		mv "$file" "sqlalchemy-$file-$pyver" || return 1
	done

	rm -Rf "$subpkgdir"/usr/lib/$python*/site-packages/migrate/tests
}

sha512sums="07c18d2f197f2bda2caa41672f7e3e278397f3b30d3cf3297200df89a051e9e46147dc1c95e20398ed575e7f3c1dd4c56f9e525ab47a960344f51d276e70639f  py-sqlalchemy-migrate-0.11.0.tar.gz"