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 391ac6e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tasks/crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def run(
# with open(root / "settings.json", encoding="utf-8") as fp:
# settings = json.load(fp)

repo_urls = ["repository.json"]
repo_urls = ["https://raw.githubusercontent.com/deathaxe/test-repository/main/repository.json"]

broken_libraries = set()
broken_packages = set()
Expand All @@ -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 391ac6e

Please sign in to comment.