# Maintainer: Integral <integral@member.fsf.org>

pkgname=pdfarranger-git
_pkgname=${pkgname%-git}
pkgver=1.14.0.r23.gefb8537
pkgrel=1
pkgdesc="Helps merge or split PDF documents and rotate, crop and rearrange pages"
arch=('any')
url="https://github.com/${_pkgname}/${_pkgname}"
license=('GPL-3.0-or-later')
depends=('ghostscript'
	'gtk3'
	'poppler-glib'
	'python'
	'python-cairo'
	'python-dateutil'
	'python-gobject'
	'python-pikepdf')
optdepends=('img2pdf: support for image files')
makedepends=('git'
	'python-build'
	'python-installer'
	'python-setuptools'
	'python-wheel')
conflicts=("${_pkgname}")
provides=("${_pkgname}")
source=("git+${url}.git")
sha256sums=('SKIP')

pkgver() {
	cd "${_pkgname}/"
	git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "${_pkgname}/"
	python -m build --wheel --no-isolation
}

package() {
	cd "${_pkgname}/"
	python -m installer --destdir="${pkgdir}" dist/*.whl
	install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
}
