# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-pefile
_pkgname=pefile
pkgver=2016.3.28
pkgrel=2
pkgdesc="Python PE parsing module"
url="https://github.com/erocarrera/pefile"
arch="noarch"
license="MIT"
depends="py3-future"
makedepends="python2-dev python3-dev py-setuptools"
install=""
subpackages="py3-$_pkgname:_py3 py2-$_pkgname:_py2"
source="https://github.com/erocarrera/$_pkgname/files/192316/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

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

package() {
	cd "$builddir"
	python2 setup.py install --root=$pkgdir/ --optimize=1 || return 1
	python3 setup.py install --root=$pkgdir/ --optimize=1 || return 1
	install -Dm0644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

_py() {
	local python=$1
	pkgdesc="$pkgdesc - $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"
	local dir=$($python -c 'import sysconfig; print(sysconfig.get_path("stdlib"))')

	mkdir -p "$subpkgdir"${dir}
	mv "$pkgdir"${dir}/* "$subpkgdir"${dir}
}

_py2() {
	_py python2
	replaces="$pkgname"
}

_py3() {
	_py python3
}



md5sums="2f3259fa2b5cf48a3fdc5422a58f854f  pefile-2016.3.28.tar.gz"
sha256sums="f24021085b5c3ef7b0898bb1f1d93eecd3839e03512769e22b0c5a10d9095f7b  pefile-2016.3.28.tar.gz"
sha512sums="f27918634507fd839b3bc71677b57676f1b2e46c43970dba158b1b4cb4202344de41fef53fffd294dd70f89b1a52aec0124e835a410ff7f0bec9b11ece425201  pefile-2016.3.28.tar.gz"