Skip to content

Commit 56f7206

Browse files
committed
Switch to zipped cache output
1 parent 5ba1839 commit 56f7206

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

AddonCatalogCacheCreator.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ def write(self):
108108
os.makedirs(self.cwd, exist_ok=True)
109109
os.chdir(self.cwd)
110110
self.create_local_copy_of_addons()
111-
with open("addon_catalog_cache.json", "w", encoding="utf-8") as f:
112-
f.write(json.dumps(self._cache, indent=" "))
111+
112+
with zipfile.ZipFile(
113+
os.path.join(self.cwd, "addon_catalog_cache.zip"), "w", zipfile.ZIP_DEFLATED
114+
) as zipf:
115+
zipf.writestr("cache.json", json.dumps(self._cache, indent=" "))
116+
113117
os.chdir(original_working_directory)
114-
print(f"Wrote cache to {os.path.join(self.cwd, 'addon_catalog_cache.json')}")
118+
print(f"Wrote cache to {os.path.join(self.cwd, 'addon_catalog_cache.zip')}")
115119

116120
def create_local_copy_of_addons(self):
117121
self.catalog = CatalogFetcher().catalog

0 commit comments

Comments
 (0)