summarylogtreecommitdiffstats
path: root/aur-install-notice.patch
blob: 41bf2cd68c51e7a263b1dd946dd11563171f16fe (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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
From 164c4fc945d1a315db8feb44e544f866c1c0f5cb Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Mon, 10 Mar 2025 12:17:21 +0100
Subject: [PATCH 1/5] AUR-specific: replace auto-updater with a notice

---
 aider/versioncheck.py | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/aider/versioncheck.py b/aider/versioncheck.py
index ac511a02..bf1490ab 100644
--- a/aider/versioncheck.py
+++ b/aider/versioncheck.py
@@ -36,29 +36,11 @@ def install_upgrade(io, latest_version=None):
     else:
         new_ver_text = "Install latest version of aider?"
 
-    docker_image = os.environ.get("AIDER_DOCKER_IMAGE")
-    if docker_image:
-        text = f"""
-{new_ver_text} To upgrade, run:
-
-    docker pull {docker_image}
+    text = f"""
+{new_ver_text} To upgrade, use the latest version available on the AUR.
 """
-        io.tool_warning(text)
-        return True
-
-    success = utils.check_pip_install_extra(
-        io,
-        None,
-        new_ver_text,
-        ["aider-chat"],
-        self_update=True,
-    )
-
-    if success:
-        io.tool_output("Re-run aider to use new version.")
-        sys.exit()
-
-    return
+    io.tool_warning(text)
+    return True
 
 
 def check_version(io, just_check=False, verbose=False):
-- 
2.48.1


From cdc572e4c28c97a84243984c59cb586fc1b4a80f Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Mon, 10 Mar 2025 13:14:04 +0100
Subject: [PATCH 2/5] AUR-specific: replace `/help` feature installer

The interactive `/help` feature requires an optional package from the
AUR. Replace the automatic installer with a notice that asks the user
to download and install the package by themselves.
---
 aider/help.py  | 11 ++---------
 aider/utils.py | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/aider/help.py b/aider/help.py
index c76188d1..c8772f0b 100755
--- a/aider/help.py
+++ b/aider/help.py
@@ -16,18 +16,11 @@ warnings.simplefilter("ignore", category=FutureWarning)
 
 
 def install_help_extra(io):
-    pip_install_cmd = [
-        "aider-chat[help]",
-        "--extra-index-url",
-        "https://download.pytorch.org/whl/cpu",
-    ]
-    res = utils.check_pip_install_extra(
+    return utils.check_aur_package(
         io,
         "llama_index.embeddings.huggingface",
-        "To use interactive /help you need to install the help extras",
-        pip_install_cmd,
+        "python-llama-index-embeddings-huggingface",
     )
-    return res
 
 
 def get_package_files():
diff --git a/aider/utils.py b/aider/utils.py
index 42012417..f3e10383 100644
--- a/aider/utils.py
+++ b/aider/utils.py
@@ -330,6 +330,22 @@ def touch_file(fname):
         return False
 
 
+def check_aur_package(io, module, aur_package):
+    if module:
+        try:
+            __import__(module)
+            return True
+        except (ImportError, ModuleNotFoundError, RuntimeError):
+            pass
+
+    io.tool_error(f"""
+    This feature requires the following package from the AUR:
+
+        {aur_package}
+"""
+    )
+
+
 def check_pip_install_extra(io, module, prompt, pip_install_cmd, self_update=False):
     if module:
         try:
-- 
2.48.1


From b39b2c3f5fe8b8d70fd74ec23d3971ab01b94af6 Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Mon, 10 Mar 2025 21:29:12 +0100
Subject: [PATCH 3/5] AUR-specific: replace google-aiplatform installer

---
 aider/models.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/aider/models.py b/aider/models.py
index 62e82ce1..3483d97a 100644
--- a/aider/models.py
+++ b/aider/models.py
@@ -18,7 +18,7 @@ from PIL import Image
 from aider.dump import dump  # noqa: F401
 from aider.llm import litellm
 from aider.sendchat import ensure_alternating_roles, sanity_check_messages
-from aider.utils import check_archlinux_package, check_pip_install_extra
+from aider.utils import check_archlinux_package, check_aur_package
 
 RETRY_TIMEOUT = 60
 
@@ -835,11 +835,10 @@ def check_for_dependencies(io, model_name):
 
     # Check if this is a Vertex AI model and ensure google-cloud-aiplatform is installed
     elif model_name.startswith("vertex_ai/"):
-        check_pip_install_extra(
+        check_aur_package(
             io,
             "google.cloud.aiplatform",
-            "Google Vertex AI models require the google-cloud-aiplatform package.",
-            ["google-cloud-aiplatform"],
+            "python-google-cloud-aiplatform",
         )
 
 
-- 
2.48.1


From 6fc30199bba55f69f47d4ea40fd3f6b5faa43267 Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Mon, 10 Mar 2025 13:15:53 +0100
Subject: [PATCH 4/5] AUR-specific: replace main branch auto-upgrader

Ask user to download and install the `aider-chat-git` package if they
wish to follow the main development branch.
---
 aider/versioncheck.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/aider/versioncheck.py b/aider/versioncheck.py
index bf1490ab..4ca0ecd1 100644
--- a/aider/versioncheck.py
+++ b/aider/versioncheck.py
@@ -17,12 +17,10 @@ def install_from_main_branch(io):
     Install the latest version of aider from the main branch of the GitHub repository.
     """
 
-    return utils.check_pip_install_extra(
+    return utils.check_aur_package(
         io,
         None,
-        "Install the development version of aider from the main branch?",
-        ["git+https://github.com/Aider-AI/aider.git"],
-        self_update=True,
+        "aider-chat-git",
     )
 
 
-- 
2.48.1


From 17742fb3bfa310cafc88246638f66340fe7a9a1a Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Mon, 10 Mar 2025 13:33:05 +0100
Subject: [PATCH 5/5] AUR-specific: replace GUI feature installer

---
 aider/main.py  |  5 ++---
 aider/utils.py | 54 --------------------------------------------------
 2 files changed, 2 insertions(+), 57 deletions(-)

diff --git a/aider/main.py b/aider/main.py
index a7608e3d..6553d8f7 100644
--- a/aider/main.py
+++ b/aider/main.py
@@ -197,11 +197,10 @@ def check_gitignore(git_root, io, ask=True):
 
 
 def check_streamlit_install(io):
-    return utils.check_pip_install_extra(
+    return utils.check_aur_package(
         io,
         "streamlit",
-        "You need to install the aider browser feature",
-        ["aider-chat[browser]"],
+        "python-streamlit",
     )
 
 
diff --git a/aider/utils.py b/aider/utils.py
index f3e10383..a58e0753 100644
--- a/aider/utils.py
+++ b/aider/utils.py
@@ -193,20 +193,6 @@ def split_chat_history_markdown(text, include_tool=False):
     return messages
 
 
-def get_pip_install(args):
-    cmd = [
-        sys.executable,
-        "-m",
-        "pip",
-        "install",
-        "--upgrade",
-        "--upgrade-strategy",
-        "only-if-needed",
-    ]
-    cmd += args
-    return cmd
-
-
 def run_install(cmd):
     print()
     print("Installing:", printable_shell_command(cmd))
@@ -346,46 +332,6 @@ def check_aur_package(io, module, aur_package):
     )
 
 
-def check_pip_install_extra(io, module, prompt, pip_install_cmd, self_update=False):
-    if module:
-        try:
-            __import__(module)
-            return True
-        except (ImportError, ModuleNotFoundError, RuntimeError):
-            pass
-
-    cmd = get_pip_install(pip_install_cmd)
-
-    if prompt:
-        io.tool_warning(prompt)
-
-    if self_update and platform.system() == "Windows":
-        io.tool_output("Run this command to update:")
-        print()
-        print(printable_shell_command(cmd))  # plain print so it doesn't line-wrap
-        return
-
-    if not io.confirm_ask("Run pip install?", default="y", subject=printable_shell_command(cmd)):
-        return
-
-    success, output = run_install(cmd)
-    if success:
-        if not module:
-            return True
-        try:
-            __import__(module)
-            return True
-        except (ImportError, ModuleNotFoundError, RuntimeError) as err:
-            io.tool_error(str(err))
-            pass
-
-    io.tool_error(output)
-
-    print()
-    print("Install failed, try running this command manually:")
-    print(printable_shell_command(cmd))
-
-
 def check_archlinux_package(io, module, archlinux_package):
     if module:
         try:
-- 
2.48.1