# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=python-configobj
pkgver=%version%
pkgrel=%release%
pkgdesc='Simple config file reader and writer'
arch=(any)
url='https://github.com/DiffSK/configobj'
license=(BSD)
depends=(python-six)
makedepends=(git python-setuptools)
source=("git+$url#commit=a58c2f4de0e9e854daa67fec630506e5a461eea9") # tag: v5.0.8
b2sums=('SKIP')

prepare() {
  cd configobj
  # Avoid the need for a local configobj install just for VERSION
  local _version=$(grep -oP "__version__ = '\K[^']+" src/configobj/_version.py)
  sed -i "/from validate/d;s/VERSION/\"$_version\"/" setup_validate.py
}

package() {
  cd configobj
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  python setup_validate.py install --root="$pkgdir" --optimize=1
}
