Skip to content

Commit

Permalink
Merge pull request #58 from jaimergp/json
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr authored Jan 30, 2024
2 parents ab6d072 + ab2394a commit 752b91b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ jobs:
cp -r conda-forge.github.io/sphinx/css site/.
cp -r conda-forge.github.io/sphinx/js site/.
cp -r conda-forge.github.io/sphinx/img site/.
- name: update JSON payload
shell: bash -l {0}
run: |
python scripts/all_json.py outputs/ site/feedstock-outputs.json
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
32 changes: 32 additions & 0 deletions scripts/all_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import argparse
import json
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path


def read_json(path):
with open(path) as f:
data = json.load(f)
return path.stem, data["feedstocks"]


def main(sources_dir, output_json):
jsons = Path(sources_dir).glob("**/*.json")

with ThreadPoolExecutor(4) as executor:
all_packages = {pkg: repos for (pkg, repos) in executor.map(read_json, jsons)}
print(f"Processed {len(all_packages)} packages.")
output_json = Path(output_json)
output_json.parent.mkdir(exist_ok=True, parents=True)
with open(output_json, "w") as f:
json.dump(all_packages, f, separators=(",", ":"), sort_keys=True)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("sources_dir")
parser.add_argument("output_json")
args = parser.parse_args()

sys.exit(main(args.sources_dir, args.output_json))

0 comments on commit 752b91b

Please sign in to comment.