From 3a841995a7c01891515744b52681e21316c3acb0 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Wed, 22 Nov 2023 20:28:27 +0100 Subject: [PATCH] Fix repository format --- tasks/crawl.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tasks/crawl.py b/tasks/crawl.py index 026afc8..9a4282b 100644 --- a/tasks/crawl.py +++ b/tasks/crawl.py @@ -130,8 +130,8 @@ def run( broken_packages = set() failed_sources = set() - packages_cache = {} - libraries_cache = {} + packages_cache = [] + libraries_cache = [] num_packages = 0 num_libraries = 0 @@ -151,7 +151,7 @@ def run( except Exception as e: print(f" Failed to fetch packages: {e}") else: - packages_cache[repo_url] = packages + packages_cache.extend(packages) if packages: print(f" Fetched {len(packages)} packages.") num_packages += len(packages) @@ -161,7 +161,7 @@ def run( except Exception as e: print(f" Failed to fetch libraries: {e}") else: - libraries_cache[repo_url] = libraries + libraries_cache.extend(libraries) if libraries: print(f" Fetched {len(libraries)} libraries.") num_libraries += len(libraries) @@ -211,6 +211,12 @@ def run( duration = time.strftime("%H:%M:%S", time.gmtime(time.time() - begin_time)) print(f"Fetched {num_packages} packages and {num_libraries} libraries in {duration}.") + # drop sources lists as they are not valid in repositories + for cache in (packages_cache, broken_libraries): + for i in cache: + if "sources" in i: + del i["sources"] + json_content = json.dumps( { "$schema": "sublime://packagecontrol.io/schemas/repository",