# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=sagetex
pkgver=3.3
pkgrel=1
pkgdesc='Allows to embed code, results of computations, and plots from SageMath into LaTeX documents'
arch=(any)
url='https://github.com/sagemath/sagetex'
license=(GPL2)
depends=(sagemath texlive-core)
source=("https://github.com/sagemath/sagetex/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('f1ebfacd18fbe99e157efbff3fce3b7ecfa1b8c9824b9b818b458b8a366f4584')

prepare() {
  cd $pkgname-$pkgver

# use python2
  find -name '*.py' | xargs sed -e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -i
}

package() {
  cd $pkgname-$pkgver

  python2 setup.py install --root "$pkgdir" --optimize=1
}
