summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 32dcc91468faf647f7a7c629997024a76adbba36 (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
# Maintainer: envolution
# Contributor: Michał Wojdyła < micwoj9292 at gmail dot com >
# Contributor: Luis Martinez <luis dot martinez at disroot dot org>
# shellcheck shell=bash disable=SC2034,SC2154

pkgname=python-speechrecognition
_pkg=speechrecognition
_pkgdir=speech_recognition
pkgver=3.14.2
pkgrel=5
pkgdesc="Google-powered speech recognition for Python"
arch=('x86_64')
url="https://github.com/Uberi/speech_recognition"
license=('MIT')
depends=(
  'flac'
  'python-audioop'
  'python-pyaudio'
  'python-requests'
  'python-tensorflow'
  'python-botocore'
  'python-boto3'
  'python-deadlib' #force to avoid potentially conflicting package python-standard-aifc
  'lib32-glibc'    #needed for flac
  'python-aifc')
optdepends=(
  'python-pocketsphinx'
  'python-vosk'
  'python-whisper'
  'python-google-api-core: Google cloud speech'
  'python-typing_extensions: Required for faster whisper'
  'python-pytorch-opt-cuda: Required for whisper'
  'python-numpy: Required for whisper'
  'python-openai: Required for openai'
  'python-soundfile: Required for whisper')

makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel')
provides=('python-speech_recognition')
checkdepends=(
  'python-pocketsphinx'
  'python-pytest'
  'python-httpx'
  'python-respx')
source=("git+https://github.com/Uberi/speech_recognition.git#tag=${pkgver}")
sha256sums=('2761e8013d3b720f2d73a3cfe354be131e812525d598274a928e6150b2e2ac51')

build() {
  cd "$_pkgdir"
  python -m build --wheel --no-isolation
}

check() {
  rm -rf test-env
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer "${_pkgdir}/dist/"*.whl
  test-env/bin/python -m pytest \
    -k "not test_google_cloud" \
    --ignore=${_pkgdir}/tests/recognizers/test_google_cloud.py \
    --ignore=${_pkgdir}/tests/recognizers/test_groq.py \
    --ignore=${_pkgdir}/tests/test_special_features.py \
    --ignore=${_pkgdir}/tests/recognizers/whisper_api/test_groq.py \
    "${_pkgdir}/tests/" || true
}

package() {
  cd "$_pkgdir"
  python -m installer --destdir "$pkgdir" dist/*.whl
  install -Dm644 LICENSE* -t ${pkgdir}/usr/share/licenses/$pkgname/
  # currently leaves unwanted tests directory
  local _site_packages=$(python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
  rm -rf "${pkgdir}${_site_packages}/tests"
}
# vim:set ts=2 sw=2 et: