# Maintainer  : Integral         <integral (@) member.fsf.org>
# Contributor : axzxc1236        <axzxc1236 (@) users.noreply.github.com>
# Contributor : LinRs            <LinRs at users.noreply.github.com>
# Contributor : hexchain         <i at hexchain.org>
# Contributor : Thaodan          <theodorstormgradex {at) gmail [dot} com>
# Contributor : Firef0x          <Firefgx {at) gmail [dot} com>
# Contributor : Bernhard Walle   <bwalle.de: bernhard            >
# Contributor : Jesse Jaara      <gmail.com, mail.ru: jesse.jaara>
# Contributor : Armin Wehrfritz
# Contributor : Patrick McCarty  <pnorcks at gmail dot com>

pkgname=osc-git
_pkgname=${pkgname%-git}
pkgver=1.27.3.r4.gd01b051
pkgrel=1
epoch=1
pkgdesc="Command line client for the openSUSE Build Service"
arch=('any')
url="https://github.com/openSUSE/${_pkgname}"
license=('GPL-2.0-or-later')
depends=('python' 'python-cryptography' 'python-ruamel-yaml' 'python-urllib3' 'python-zstandard' 'diffstat')
makedepends=('git' 'python-setuptools')
optdepends=('obs-build: required to run local builds'
	'obs-service-format_spec_file: for running the format_spec_file source service'
	'obs-service-download_files: for running the download_files source service'
	'python-keyring: keyring support'
	'python-progressbar: progressbar support for operations like uploading and services'
	'python-distro: Linux OS platform information API'
)
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 setup.py build
}

package() {
	cd "${_pkgname}/"
	python setup.py install --root="${pkgdir}/" --optimize=1 --prefix=/usr

	install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
	install -d "${pkgdir}/usr/share/doc/${_pkgname}"
	cp -r doc/* "${pkgdir}/usr/share/doc/${_pkgname}/"

	cd contrib
	install -Dm644 "complete.sh" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
	install -Dm644 "${_pkgname}.zsh" "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
	install -Dm644 "${_pkgname}.fish" -t "${pkgdir}/usr/share/fish/vendor_completions.d/"
}
