Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions updateFabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from cachecontrol.caches import FileCache

import sys

forever_cache = FileCache('http_cache', forever=True)
sess = CacheControl(requests.Session(), forever_cache)

Expand Down Expand Up @@ -66,16 +68,31 @@ def compute_jar_file(path, url):
mkdirs("upstream/fabric/loader-installer-json")
mkdirs("upstream/fabric/jars")

excs = []

# get the version list for each component we are interested in
for component in ["intermediary", "loader"]:
index = get_json_file("upstream/fabric/meta-v2/" + component + ".json", "https://meta.fabricmc.net/v2/versions/" + component)
for it in index:
jarMavenUrl = get_maven_url(it["maven"], "https://maven.fabricmc.net/", ".jar")
compute_jar_file("upstream/fabric/jars/" + it["maven"].replace(":", "."), jarMavenUrl)
try:
compute_jar_file("upstream/fabric/jars/" + it["maven"].replace(":", "."), jarMavenUrl)
except:
e = sys.exception()
e.add_note(f'for jarMavenUrl={jarMavenUrl}')
excs.append(e)

# for each loader, download installer JSON file from maven
with open("upstream/fabric/meta-v2/loader.json", 'r', encoding='utf-8') as loaderVersionIndexFile:
loaderVersionIndex = json.load(loaderVersionIndexFile)
for it in loaderVersionIndex:
mavenUrl = get_maven_url(it["maven"], "https://maven.fabricmc.net/", ".json")
get_json_file("upstream/fabric/loader-installer-json/" + it["version"] + ".json", mavenUrl)
try:
get_json_file("upstream/fabric/loader-installer-json/" + it["version"] + ".json", mavenUrl)
except:
e = sys.exception()
e.add_note(f'for mavenUrl={mavenUrl}')
excs.append(e)

if excs:
raise ExceptionGroup("Downloading some Fabric files failed", excs)