summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7e54482ceca2a684aef1cf6998f3a5933026fe7e (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
# Maintainer: Thomas Jost <schnouki@schnouki.net>
# Contributor: Sainnhe Park <sainnhe@gmail.com>
pkgname=basedpyright-git
_pkgname=basedpyright
pkgver=v1.13.0.r1.g19aa64eeb
pkgrel=2
pkgdesc="Fork of pyright, a static type checker for Python, with various improvements and new features"
arch=('any')
url="https://github.com/DetacHead/basedpyright"
license=('MIT')
depends=('nodejs' 'python')
makedepends=('npm' 'python-installer')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("${_pkgname}::git+https://github.com/DetachHead/basedpyright.git")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  git -C "${srcdir}/${_pkgname}" clean -dfx
}

build() {
  cd "${srcdir}/${_pkgname}"
  ./pw pdm build --verbose
}

package() {
  cd "${srcdir}/${_pkgname}"
  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dm644 README.md "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
  install -Dm644 CONTRIBUTING.md "${pkgdir}/usr/share/doc/${_pkgname}/CONTRIBUTING.md"
  cp -r docs "${pkgdir}/usr/share/doc/${_pkgname}/docs"
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"

  # Run JS scripts directly, without nodejs_wheel
  _pyver=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
  rm "${pkgdir}/usr/bin/basedpyright" "${pkgdir}/usr/bin/basedpyright-langserver"
  ln -s ../lib/python${_pyver}/site-packages/${_pkgname}/index.js "${pkgdir}/usr/bin/basedpyright"
  ln -s ../lib/python${_pyver}/site-packages/${_pkgname}/langserver.index.js "${pkgdir}/usr/bin/basedpyright-langserver"
}

# vim:set ts=2 sw=2 et: