blob: 36128ff47ee0b99da86f7f522d37c6369d01331c (
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# Maintainer: xiota / aur.chaotic.cx
_pkgname="baca-ereader"
pkgname="$_pkgname-git"
pkgver=0.1.17.r0.g13ee794
pkgrel=2
pkgdesc="TUI Ebook Reader"
url="https://github.com/wustho/baca"
license=("GPL-3.0-only")
arch=('any')
provides=("$_pkgname")
conflicts=(
"$_pkgname"
'baca' # baca-cli
)
depends=(
'python-appdirs'
'python-beautifulsoup4'
'python-peewee'
'python-rich'
# AUR
'python-climage'
# 'python-kdtree'
'python-markdownify'
'python-textual'
'python-thefuzz'
)
makedepends=(
'git'
'pandoc' # convert readme to epub
'python-build'
'python-importlib-metadata' # prepare
'python-installer'
'python-poetry-core'
'python-wheel'
)
_pkgsrc="$_pkgname"
source=(
"$_pkgsrc"::"git+$url.git"
"baca_fit.png"::"https://user-images.githubusercontent.com/43810055/227891952-45df1c36-5113-4793-84b6-249725d3ba19.png"
"pretty_yes_no_cap.png"::"https://user-images.githubusercontent.com/43810055/228417623-ac78fb84-0ee0-4930-a843-752ef693822d.png"
)
sha256sums=(
'SKIP'
'0ba4c5e919d4db2704b7810c7790b2a73d8367e0db983a64cc7fa292c1ba1dd8'
'4039932020078108773333842b308f1b3f34af6bcb4ac9a54649ada5ace18c90'
)
prepare() {
cd "$srcdir/$_pkgname"
# fix docs
_images=(
"baca_fit"
"pretty_yes_no_cap"
)
for i in ${_images[@]}; do
sed -Ei -e "s@\\!\\[$image\\]\\([^\\)]+\\)@![$image]($image.png)@" "README.md"
done
# convert readme to epub
pandoc -t epub --metadata title="Baca eReader Readme" -o README.epub README.md
# textual > 0.16.0 mouse scrolling glitch
# https://github.com/wustho/baca/issues/10
local _textual_version=$(python -c 'from importlib.metadata import version; print(version("textual"))')
if [[ $(vercmp "$_textual_version" 0.16.0) -gt 0 ]]; then
sed -E -e 's@^(\s*self)\.screen\.(scroll_(up|down))@\1.\2@g' \
-i "src/baca/components/contents.py"
fi
}
pkgver() {
cd "$_pkgsrc"
git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
cd "$_pkgsrc"
python -m build --no-isolation --wheel
}
package() {
cd "$_pkgsrc"
python -m installer --destdir="$pkgdir" dist/*.whl
# documents
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" "README.md"
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" "README.epub"
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" "$srcdir/baca_fit.png"
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" "$srcdir/pretty_yes_no_cap.png"
}
|