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.

75 lines
1.6KB

  1. import sys
  2. import os
  3. import glob
  4. import json
  5. import time
  6. import build_plugin
  7. build_plugin.system("git pull")
  8. build_plugin.system("git submodule update --init --recursive")
  9. plugin_dirs = sys.argv[1:]
  10. if not plugin_dirs:
  11. plugin_dirs = glob.glob("repos/*")
  12. built_slugs = []
  13. for plugin_dir in plugin_dirs:
  14. slug = os.path.basename(plugin_dir)
  15. manifest_filename = f"manifests/{slug}.json"
  16. try:
  17. with open(manifest_filename, "r") as f:
  18. manifest = json.load(f)
  19. except Exception as e:
  20. print(e)
  21. input()
  22. # We need a repoVersion to build
  23. if 'repoVersion' not in manifest:
  24. continue
  25. # Skip if update is not needed
  26. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  27. continue
  28. # Build repo
  29. success = build_plugin.build(plugin_dir)
  30. if not success:
  31. print(f"{slug} failed")
  32. input()
  33. continue
  34. build_plugin.system('mv -vi stage/* ../packages/')
  35. build_plugin.delete_stage()
  36. # Update build information
  37. manifest['latestVersion'] = manifest['repoVersion']
  38. manifest['buildTimestamp'] = round(time.time())
  39. manifest['status'] = "available"
  40. with open(manifest_filename, "w") as f:
  41. json.dump(manifest, f, indent=" ")
  42. built_slugs.append(slug)
  43. os.system("qutebrowser \"https://github.com/VCVRack/library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+" + slug + "\" &")
  44. if not built_slugs:
  45. raise Exception("Nothing to build")
  46. # Upload packages
  47. build_plugin.system("cd ../packages && make upload")
  48. # Commit repository
  49. build_plugin.system("git add -u")
  50. build_plugin.system("git commit -m 'Update builds'")
  51. build_plugin.system("git push")
  52. print()
  53. print("Built " + ", ".join(built_slugs))