summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ebcbe3e5efc26ecf23b1e73ede11e94d2ca120e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Maintainer: Mark Wagie <mark at proton dot me>
pkgname=python-libsass
_name=${pkgname#python-}
pkgver=0.23.0
pkgrel=2
pkgdesc="Sass for Python: A straightforward binding of libsass for Python."
arch=('x86_64' 'aarch64')
url="https://sass.github.io/libsass-python/"
license=('MIT')
depends=('libsass' 'python-setuptools')
makedepends=('python-build' 'python-installer' 'python-wheel')
#makedepends+=('python-sphinx')  # needed for docs
#checkdepends=('python-pip' 'python-pytest' 'python-werkzeug')
source=("$_name-$pkgver.tar.gz::https://github.com/sass/libsass-python/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('4bff7819756f52f6e4592f03f205104d1ca431088d9452aed5042f89a36f9873')

build() {
  cd "$_name-python-$pkgver"
  export SYSTEM_SASS="1"
  python -m build --wheel --no-isolation

#  pushd docs
  # There are differences between Python's naming of architectures and the
  # ${CARCH} variable. We need to ask Python for the platform name
#  local PLATFORM=$(python -c "import sysconfig; print(sysconfig.get_platform())")
#  export PYTHONPATH=$(echo ../build/lib.${PLATFORM}-*)
#  make man
#  popd
}

#check() {
#  cd "$_name-python-$pkgver"
#  local PLATFORM=$(python -c "import sysconfig; print(sysconfig.get_platform())")
#  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
#  export PYTHONPATH=build/lib.${PLATFORM}-cpython-${python_version//./}
#  pytest sasstests.py
#}

package() {
  cd "$_name-python-$pkgver"
  export SYSTEM_SASS="1"
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"

  # We don't want to install tests
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm "${pkgdir}${site_packages}/sasstests.py" \
    "${pkgdir}${site_packages}"/__pycache__/sasstests.*.pyc
}