You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1017B

  1. import sys
  2. import os
  3. import glob
  4. import json
  5. import time
  6. import build_plugin
  7. built_slugs = []
  8. for manifest_filename in glob.glob("manifests/*.json"):
  9. slug = os.path.basename(manifest_filename).split('.')[0]
  10. with open(manifest_filename, "r") as f:
  11. manifest = json.load(f)
  12. # We need a repoVersion to build
  13. if 'repoVersion' not in manifest:
  14. continue
  15. # Skip if update is not needed
  16. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  17. continue
  18. # Build repo
  19. plugin_dir = f"repos/{slug}"
  20. success = build_plugin.build(plugin_dir)
  21. if not success:
  22. print(f"{slug} failed")
  23. input()
  24. continue
  25. # Update build information
  26. manifest['latestVersion'] = manifest['repoVersion']
  27. manifest['buildTimestamp'] = round(time.time())
  28. manifest['status'] = "available"
  29. with open(manifest_filename, "w") as f:
  30. json.dump(manifest, f, indent=" ")
  31. built_slugs.append(slug)
  32. if built_slugs:
  33. print()
  34. print("Built " + ", ".join(built_slugs))
  35. else:
  36. print("Nothing to build")