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.

55 lines
1.1KB

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