blob: 7ad940f4426ad1adc727679026284c4812864212 (
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
|
# Maintainer:
# Contributor: dreieck (https://aur.archlinux.org/account/dreieck)
if [ -z "$CARGO_HOME" ]; then
export CARGO_HOME="$SRCDEST/cargo-home"
fi
_pkgname="python-tiktoken"
pkgname="$_pkgname-git"
pkgver=0.7.0.r1.gc0ba74c
pkgrel=1
pkgdesc="A fast BPE tokeniser for use with OpenAI's models"
url="https://github.com/openai/tiktoken"
license=('MIT')
arch=(
'aarch64'
'armv7h'
'i686'
'x86_64'
)
depends=(
'python'
'python-regex'
'python-requests'
)
makedepends=(
'git'
'python-build'
'python-installer'
'python-setuptools'
'python-setuptools-rust'
'python-wheel'
)
checkdepends=(
'python-hypothesis'
'python-pytest'
)
optdepends=(
# AUR
'python-blobfile: for reading blobfiles'
)
provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")
_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')
pkgver() {
cd "$_pkgsrc"
git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$_pkgsrc"
cargo fetch --target "$CARCH-unknown-linux-gnu"
}
build() {
cd "$_pkgsrc"
python -m build --wheel --no-isolation
}
check() {
cd "$_pkgsrc"
rm -r tiktoken tiktoken.egg-info tiktoken_ext
local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
PYTHONPATH="build/lib.linux-$CARCH-cpython-$python_version" python -m pytest
}
package() {
cd "$_pkgsrc"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
}
|