blob: 84e268c5959eabf8de5688fbabb84bc387ab6833 (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
pkgbase=aider-chat
pkgname=(
'aider-chat'
'aider-chat-docs'
)
_gitpkgname=aider
pkgver=0.76.0
pkgrel=1
pkgdesc='AI pair programming in your terminal'
arch=('any')
url='https://github.com/Aider-AI/aider'
license=('Apache-2.0')
depends=(
'flake8'
'litellm'
'python'
'python-beautifulsoup4'
'python-configargparse'
'python-diff-match-patch'
'python-diskcache'
'python-dotenv'
'python-gitpython'
'python-grep-ast'
'python-httpx'
'python-importlib_resources'
'python-json5'
'python-jsonschema'
'python-mixpanel'
'python-networkx'
'python-numpy'
'python-packaging'
'python-pathspec'
'python-pexpect'
'python-pillow'
'python-posthog'
'python-prompt_toolkit'
'python-psutil'
'python-pydub'
'python-pygments'
'python-pypandoc'
'python-pyperclip'
'python-requests'
'python-rich'
'python-sounddevice'
'python-soundfile'
'python-tqdm'
'python-tree-sitter-language-pack' # undeclared transitive dependency of grep-ast
'python-watchfiles'
'python-yaml'
)
makedepends=(
'jekyll'
'python-build'
'python-installer'
'python-setuptools'
'python-setuptools-scm'
'python-wheel'
'ruby-jekyll-feed'
'ruby-jekyll-redirect-from'
'ruby-jekyll-sitemap'
'ruby-just-the-docs'
'ruby-rake'
)
checkdepends=(
'chromium'
'python-playwright'
'python-pytest'
'python-streamlit'
)
# shellcheck disable=SC2016 # Not meant to expand
optdepends=(
'chromium: for web scraping'
# Packages are yet to be written, see comment in `check()`
# 'python-llama-index-embeddings-huggingface: to use the interactive `/help` feature'
'python-playwright: for web scraping'
'python-streamlit: for a graphical user interface'
)
source=(
"${_gitpkgname}-${pkgver}.tar.gz::https://github.com/Aider-AI/aider/archive/v${pkgver}.tar.gz"
'archlinux-use-system.patch'
'aur-install-notice.patch'
'fix-build-from-tarball.patch'
)
sha512sums=('4a9ab2c7572a6966e1673e00ae33cf3572a191afcc07f615d80c99353f43e925de2c2f45c0129060eff0c7beb00a84fafbd7638746ed95d5cb140aad8d09fa67'
'ead5c14e92d3929caebbfd5f82ab56bc846267b54a8ff57f5147557522e41b1d8d0b548c46ec91980a22af17ac372a597a1641e1a0035a40412841b6f9d7d17f'
'b916255533f99228c7ccb8078e3be09cb33c3817d9d871d7a9f873fe8e7028b9d3f534e8ce97942e6b0956194371cb3746351712c56c373a0d3f3266065a2f96'
'87b05d1b08007f32707fc9ed598eb6d31af1c29f5e4bcebf4a4fe08c4a6042ebb6c56dee8cb8e86e17be91af801a8852e4b39344d90da1990b44130b0b51125b')
prepare() {
cd "${_gitpkgname}-${pkgver}"
# Replace custom downloads with system packages
patch -p1 < ../archlinux-use-system.patch
# Replace auto-updater and optdepends installers with AUR notice
patch -p1 < ../aur-install-notice.patch
# Fix issues with incomplete build from source tarball (needs upstreaming)
patch -p1 < ../fix-build-from-tarball.patch
# Update Gemfile to allow newer version of the dependencies,
# add undeclared dependencies, and remove dependencies not
# relevant to this package
#
# shellcheck disable=SC2016 # Not meant to expand
sed -i \
-e 's/"\([0-9]\)/">=\1/g' \
-e '$agem "jekyll-feed"' \
-e "s/\(^gem 'github-pages'.*\)/#\1/" \
-e 's/\(^gem "html-proofer".*\)/#\1/' \
aider/website/Gemfile
# Adjust base URL for documentation
sed -i \
-e 's|^\(url:\).*|\1 file:///usr/share/doc/'"${pkgbase}"'/html|' \
aider/website/_config.yml
sed -i \
-e 's|(https://aider\.chat|(file:///usr/share/doc/'"${pkgbase}"'/html|' \
aider/website/index.md
find aider/website/docs -name '*.md' -exec sed -i \
-e 's|](/|](file:///usr/share/doc/'"${pkgbase}"'/html/|' \
'{}' +
}
build() {
cd "${_gitpkgname}-${pkgver}"
echo >&2 'Building wheel'
export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"
python -m build --wheel --no-isolation
cd aider/website
echo >&2 'Generating HTML documentation'
export JEKYLL_ENV=production
jekyll build --baseurl "file:///usr/share/doc/${pkgbase}/html/"
echo >&2 'Removing unnecessary files'
find _site \
-type f \
-'(' \
-name "install.ps1" -o \
-name "install.sh" -o \
-name "robots.txt" -o \
-name "sitemap.xml" \
-')' \
-delete
}
check() {
cd "${_gitpkgname}-${pkgver}"
python -m venv --system-site-packages test-env
test-env/bin/python -m installer dist/*.whl
# Use a clean environment (env -i) to avoid incurring unintended
# LLM API usage costs.
#
# Additionally, skip the following tests:
#
# - tests for the `/help` feature, which require two system
# packages `python-llama-index-core` and `-embeddings-huggingface`
#
# - commit message tests, which require the current working dir
# to be part of a Git worktree
#
# - dependency tests for Bedrock and Vertex AI models:
# not applicable because dependencies have been replaced with
# optdepends
#
echo >&2 'Running unit tests'
env -i PATH="${PATH}" python -m pytest \
-k "not test_get_commit_message`
` and not TestHelp`
` and not test_check_for_dependencies_"
echo >&2 'Testing the executable'
test-env/bin/${_gitpkgname} --version > actual.txt
if ! grep -qF "${_gitpkgname} ${pkgver}" actual.txt; then
printf >&2 '%s\n' 'Unexpected test output:' '==='
cat >&2 actual.txt
printf >&2 '\n%s\n' '==='
exit 1
fi
}
# shellcheck disable=SC2128
package_aider-chat() {
cd "${_gitpkgname}-${pkgver}"
echo >&2 'Packaging the wheel'
python -I -m installer --destdir="${pkgdir}" dist/*.whl
echo >&2 'Packaging the license'
install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
LICENSE.txt
}
# shellcheck disable=SC2128
package_aider-chat-docs() {
depends=()
cd "${_gitpkgname}-${pkgver}"
echo >&2 'Packaging the documentation'
install -D -m 644 -t "${pkgdir}/usr/share/doc/${pkgbase}" \
README.md
mkdir "${pkgdir}/usr/share/doc/${pkgbase}/html"
cp -R --preserve=mode -t "${pkgdir}/usr/share/doc/${pkgbase}/html" \
aider/website/_site/*
echo >&2 'Packaging the license'
install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
LICENSE.txt
}
|