# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor : Martin Wimpress <code@flexion.org>

pkgname=gufw
_pkgver=19.10
pkgver=${_pkgver}.0
pkgrel=1
pkgdesc='Uncomplicated way to manage your Linux firewall'
url='https://gufw.org/'
arch=('any')
license=('GPL3')
depends=('gtk3' 'polkit' 'python' 'python-gobject' 'ufw' 'webkit2gtk' 'desktop-file-utils' 'gtk-update-icon-cache')
makedepends=('intltool' 'python-distutils-extra')
source=(https://launchpad.net/gui-ufw/trunk/${_pkgver}/+download/gui-ufw-${pkgver}.tar.gz)
sha256sums=('18c155ef7b62e457e7c89fb9827db531a453d3fd766911c1b09c9fc716255cba')
sha512sums=('4155c7cd729baecf7ae49e91e72ef8020d8e289379acc5273211031faf63056ebb795577d761cf79694ed9a189a2970b50264822e64e0863d0b96deaaab3ef81')

prepare() {
  cd gui-ufw-${pkgver}
  local PYTHONVERSION="$(python -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')"
  sed -E "s|python3\.[0-9]|python${PYTHONVERSION}|g" -i bin/gufw-pkexec
  sed -E 's/(loginctl\|grep \$\(whoami\))/\1|sort -n|tail -n 1/g' -i bin/gufw
}

package() {
  cd gui-ufw-${pkgver}
  # required so desktop, icon and translation files get installed
  export XDG_RUNTIME_DIR="/tmp/${pkgname}"
  python setup.py install --prefix=/usr --root="${pkgdir}" -O1
}

# vim: ts=2 sw=2 et:
