summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9a257d3323460bb23dd512bec66483ad6af393f7 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>

pkgname=python-julius-git
_gitpkgname=julius
pkgver=r69.486c032
pkgrel=1
pkgdesc='Fast PyTorch based DSP for audio and 1D signals'
arch=('any')
url='https://github.com/adefossez/julius'
license=('MIT')
depends=(
  'python'
  'python-pytorch'
)
makedepends=(
  'git'
  'python-build'
  'python-pdoc'
  'python-installer'
  'python-setuptools'
  'python-setuptools-scm'
  'python-sphinx'
  'python-sphinx_rtd_theme'
  'python-wheel'
)
checkdepends=('python-resampy')
provides=("python-julius=${pkgver}")
conflicts=('python-julius')

source=(
  "${_gitpkgname}::git+https://github.com/adefossez/julius.git"
)

sha512sums=(
  'SKIP'
)

pkgver() {
  printf "r%s.%s" \
    "$(git -C "${_gitpkgname}" rev-list --count HEAD)" \
    "$(git -C "${_gitpkgname}" rev-parse --short HEAD)"
}

prepare() {
  cd "${_gitpkgname}"

  echo >&2 'Fixing unit test'
  sed -i -e 's/tol=2/tol=10/' tests/test_resample.py
}

build() {
  cd "${_gitpkgname}"
  echo >&2 'Building wheel'
  python -m build --wheel --no-isolation

  echo >&2 'Generating documentation'
  pdoc --template-dir pdoc -o docs julius
}

check() {
  cd "${_gitpkgname}"
  echo >&2 'Running unit tests'
  python -m unittest discover -v
}

package() {
  cd "${_gitpkgname}"

  echo >&2 'Packaging the wheel'
  python -I -m installer --destdir="${pkgdir}" dist/*.whl

  echo >&2 'Packaging the documentation'
  install -D -m 644 -t "${pkgdir}/usr/share/doc/${pkgname}" \
    README.md
  mkdir -p "${pkgdir}/usr/share/doc/${pkgname}/html"
  cp -R --preserve=mode -t "${pkgdir}/usr/share/doc/${pkgname}/html" \
    docs

  echo >&2 'Packaging the license'
  install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
    LICENSE
}