summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e3c5584773295554334416303d386cad02125030 (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
51
52
# Maintainer: Sainnhe Park <sainnhe@gmail.com>
pkgname=pyright-git
_pkgname=pyright
pkgver=1.1.57.r0.geaa66050
pkgrel=1
pkgdesc="Static type checker for Python"
arch=('any')
url="https://github.com/microsoft/pyright"
license=('MIT')
depends=('nodejs')
makedepends=('npm')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("${_pkgname}::git+https://github.com/microsoft/pyright.git")
sha256sums=('SKIP')

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

prepare() {
  rm -rf "${pkgdir}/usr/lib/node_modules/${_pkgname}"
}

build() {
  cd "${srcdir}/${_pkgname}"
  npm run install:all
  npm run build
}

package() {
  install -d "${pkgdir}/usr/bin"
  install -d "${pkgdir}/usr/lib/node_modules/${_pkgname}"
  install -d "${pkgdir}/usr/share/doc/${_pkgname}"
  install -d "${pkgdir}/usr/share/licenses/${pkgname}"

  cd "${srcdir}/${_pkgname}"

  cp -r dist "${pkgdir}/usr/lib/node_modules/${_pkgname}/dist"
  install -Dm755 index.js "${pkgdir}/usr/lib/node_modules/${_pkgname}/index.js"
  install -Dm755 langserver.index.js "${pkgdir}/usr/lib/node_modules/${_pkgname}/langserver.index.js"
  ln -s "/usr/lib/node_modules/${_pkgname}/index.js" "${pkgdir}/usr/bin/pyright"
  ln -s "/usr/lib/node_modules/${_pkgname}/langserver.index.js" "${pkgdir}/usr/bin/pyright-langserver"

  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"
}

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