Skip to content

Commit

Permalink
Build a channel file
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Nov 24, 2023
1 parent 7dc67f6 commit 1128514
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tasks/crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def run(
print(f"Fetching packages from {repo_url}...")

try:
packages = [package for _, package in repo.get_packages(blacklist)]
packages = []
for _, info in repo.get_packages(blacklist):
del info["sources"]
packages.append(info)
except Exception as e:
print(f" Failed to fetch packages: {e}")
else:
Expand All @@ -157,7 +160,10 @@ def run(
num_packages += len(packages)

try:
libraries = [library for _, library in repo.get_libraries(blacklist)]
libraries = []
for _, info in repo.get_libraries(blacklist):
del info["sources"]
libraries.append(info)
except Exception as e:
print(f" Failed to fetch libraries: {e}")
else:
Expand Down Expand Up @@ -213,8 +219,9 @@ def run(

json_content = json.dumps(
{
"$schema": "sublime://packagecontrol.io/schemas/repository",
"$schema": "sublime://packagecontrol.io/schemas/channel",
"schema_version": "4.0.0",
"repositories": repo_urls,
"packages": packages_cache,
"libraries": libraries_cache
},
Expand All @@ -228,7 +235,7 @@ def run(
dist_dir = root / '_site'
dist_dir.mkdir(exist_ok=True)

result = store_asset(dist_dir / 'libraries.json', json_content)
result = store_asset(dist_dir / 'channel_v4.json', json_content)
if result:
print("Stored resolved repository!")
else:
Expand Down

0 comments on commit 1128514

Please sign in to comment.