Skip to content

Commit 1805a5e

Browse files
committed
fix udpate-version script being blocked
1 parent d2856e7 commit 1805a5e

File tree

6 files changed

+40
-9
lines changed

6 files changed

+40
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.flatpak-builder/
22
build/
3+
.venv/

.mise.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[env]
2+
_.file = '.env'
3+
OPENAI_CONFIG_PATH = "{{ [config_root, '.openai'] | join_path }}"
4+
5+
[tools]
6+
# specify single or multiple versions
7+
python = { version="3.12", virtualenv=".venv"}
8+
9+
[settings]
10+
python_venv_auto_create = true

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv"
3+
}

com.useanything.AnythingLLMDesktop.metainfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</screenshots>
2121
<releases>
2222
<release type="stable" version="1.6.7" date="2024-09-14" />
23-
<release type="stable" version="1.7.3" date="2025-01-29" /></releases>
23+
<release type="stable" version="1.7.3" date="2025-01-29" /><release type="stable" version="1.7.3-r2" date="2025-02-06" /></releases>
2424
<url type="homepage">https://anythingllm.com/</url>
2525
<url type="bugtracker">https://github.com/Mintplex-Labs/anything-llm/issues</url>
2626
<url type="help">https://docs.anythingllm.com/</url>

sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[
22
{
33
"type": "file",
4-
"url": "https://cdn.useanything.com/latest/AnythingLLMDesktop.AppImage",
5-
"sha256": "d0aeb1e2b730c29e50090c53610df3945e1c4d6e102956820e9d1cc2ef001c94"
4+
"url": "https://cdn.anythingllm.com/latest/AnythingLLMDesktop.AppImage",
5+
"sha256": "c1402ed5f17ed33b83d032cfe6e0b0221129a0601eeb5526c40b28f9da1065a2"
66
},
77
{
88
"type": "file",
99
"path": "com.useanything.AnythingLLMDesktop.metainfo.xml",
10-
"sha256": "77c9ea185c59db9afc21a04b9457b3923bbf7f519ae667498fcc4120a5749dc8"
10+
"sha256": "95a98f20059a48df0c250ac3541624bc84b28ee20a89ff6f3092392e8230a53f"
1111
}
1212
]

update-version.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
#!/user/bin/python
2+
import subprocess
23
import urllib.request
4+
import re
5+
import os
36
import email.utils
47
import hashlib
58
import json
69
import xml.etree.ElementTree
710

11+
812
app_image_url = "https://cdn.anythingllm.com/latest/AnythingLLMDesktop.AppImage"
913
check_version_url = "https://cdn.anythingllm.com/latest/version.txt"
10-
f = urllib.request.urlopen(check_version_url)
11-
last_modified_tuple = email.utils.parsedate(f.info()['Last-Modified'])
12-
latest_version = f.read().decode('ascii')
14+
result = subprocess.run(['curl', '-si', check_version_url], stdout=subprocess.PIPE)
15+
output_lines = result.stdout.decode().splitlines()
16+
for line in output_lines:
17+
m = re.match('^last-modified: (.*)', line)
18+
if m:
19+
last_modified_str = m.group(1)
20+
break
21+
22+
if not last_modified_str:
23+
print("Failed to get last-modified")
24+
exit(1)
25+
26+
last_modified_tuple = email.utils.parsedate(last_modified_str)
27+
latest_version = output_lines[-1].strip()
1328
last_modified = f"{last_modified_tuple[0]}-{last_modified_tuple[1]:02}-{last_modified_tuple[2]:02}"
1429
latest = (latest_version, last_modified)
1530

@@ -32,15 +47,17 @@
3247
# Open the URL and read its content
3348
app_image_sha256_hash = hashlib.sha256()
3449

50+
file_name = 'AnythingLLMDesktop.AppImage'
3551
# Open the URL and read the content in chunks
36-
with urllib.request.urlopen(app_image_url) as response:
52+
result = subprocess.run(['curl', '-Lo', file_name, app_image_url], stdout=subprocess.PIPE)
53+
with open(file_name, 'rb') as response:
3754
while True:
3855
chunk = response.read(1024 * 1024)
3956
if not chunk:
4057
break
4158
# Update the hash with the current chunk
4259
app_image_sha256_hash.update(chunk)
43-
60+
os.remove(file_name)
4461
# Return the final hash as a hexadecimal string
4562
latest_version_sha256 = app_image_sha256_hash.hexdigest()
4663
print("Done.")

0 commit comments

Comments
 (0)