File PKGBUILD of Package osc

pkgname=osc
pkgver=1.24.0
pkgrel=1
pkgdesc="openSUSE build service command-line tool"
arch=('any')
url="https://github.com/openSUSE/osc/"
license=('GPL')
depends=(diffstat python python-build python-installer python-cryptography python-urllib3 python-distro python-ruamel-yaml python-argparse-manpage)
makedepends=(python-setuptools)
source=("https://github.com/openSUSE/osc/archive/${pkgver}/osc-${pkgver}.tar.gz")
sha256sums=('SKIP')

build() {
  cd "${pkgname}-${pkgver}"

  # Build man page (equivalent to execute_after_dh_auto_build)
  PYTHONPATH=. argparse-manpage \
    --output=osc.1 \
    --format=single-commands-section \
    --module=osc.commandline \
    --function=argparse_manpage_get_parser \
    --project-name=osc \
    --prog=osc \
    --description="openSUSE build service command-line tool" \
    --author="Contributors to the osc project." \
    --url="https://github.com/openSUSE/osc/"

  python -m build --wheel --no-isolation
}

check() {
	cd "${pkgname}-${pkgver}"
	python -m unittest -b
}

package() {
  cd "${pkgname}-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl

  # Man page
  install -Dm644 osc.1 "${pkgdir}/usr/share/man/man1/osc.1"

  # Changelog
  install -Dm644 NEWS "${pkgdir}/usr/share/doc/${pkgname}/NEWS"

  # Bash completion (kept in project-specific dir like Debian)
  install -Dm644 contrib/osc.complete \
    "${pkgdir}/usr/lib/osc/complete"

  # csh completion profile script
  install -Dm644 contrib/complete.csh \
    "${pkgdir}/etc/profile.d/osc.csh"

  # fish completion
  install -Dm644 contrib/osc.fish \
    "${pkgdir}/usr/share/fish/vendor_completions.d/osc.fish"
}
openSUSE Build Service is sponsored by