# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Hugo Doria <hugo@archlinux.org>
# Contributor: Mario A. Vazquez <mario_vazq@hotmail.com>

pkgbase=pyxdg
pkgname=python-pyxdg
pkgver=0.28
pkgrel=7
pkgdesc="Python library to access freedesktop.org standards"
arch=('any')
url="http://freedesktop.org/Software/pyxdg"
license=("LGPL-2.0-only")
depends=('python')
conflicts=('python-xdg')
provides=('python-xdg')
replaces=('python-xdg<0.26-5')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${pkgbase::1}/${pkgbase}/${pkgbase}-${pkgver}.tar.gz"
        pyxdg-python3.12.patch
        pyxdg-python3.14.patch
        pyxdg-python3.15.patch)
b2sums=('36e2f6ca14f08a2fb7018168c2620b8203f0a601bd4931b4b1d5131b3fa3241fdd82e8ffa5e915c56d8d4773ddbd9eacbf33e4e01e458149c73046041467ca15'
        'dfe96f7daae3cb4efe84c26c3272fcf905e6c265440ca1b317325886fbcfe590f9bced82aaa8726393aa80c197a2619e441a140c709cccd1ae3a78955b5451db'
        '87f0bcb6fb1c426cf759c322ccea3b20474b7cb063c2df890acfb8909768272ed8095c9d59c9f5dee572256ba837ab20492c1ddd9a97260cb9a1a390dc4f5cf8'
        '5175640dc3257357609a9e859b6c8d1c1596249964ed42ea9aff64bdaa173f207b672727ddc1339eb6f8aa916f845b13642d9b488f138e9c1b0af138c42976a4')
validpgpkeys=('6391296E3F25C0A721C1F1AFAF88B3AC5DECB224') # Thomas Kluyver

prepare() {
  cd "${srcdir}/${pkgbase}-${pkgver}"

  # Python compatibility fixes
  # https://gitlab.freedesktop.org/xdg/pyxdg/-/commit/275865e620471c194560824232be632c9cb61600
  patch -Np1 -i ../pyxdg-python3.12.patch
  # https://gitlab.freedesktop.org/xdg/pyxdg/-/commit/9291d419017263c922869d79ac1fe8d423e5f929
  patch -Np1 -i ../pyxdg-python3.14.patch
  # https://gitlab.freedesktop.org/xdg/pyxdg/-/commit/63033ac306aa26d32e1439417e59ae8f8a4c9820
  patch -Np1 -i ../pyxdg-python3.15.patch
}

build() {
  cd "${srcdir}/${pkgbase}-${pkgver}"
  python setup.py build
}

package() {
  cd "${srcdir}/${pkgbase}-${pkgver}"
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
}
