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.

77 lines
1.6KB

  1. import sys
  2. import os
  3. import glob
  4. import json
  5. import time
  6. import build
  7. build.system("git pull")
  8. build.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. manifest_filename = f"{plugin_dir}/plugin.json"
  15. try:
  16. with open(manifest_filename, "r") as f:
  17. manifest = json.load(f)
  18. except IOError:
  19. # Skip plugins without plugin.json
  20. continue
  21. slug = manifest['slug']
  22. library_manifest_filename = f"manifests/{slug}.json"
  23. library_manifest = None
  24. try:
  25. with open(library_manifest_filename, "r") as f:
  26. library_manifest = json.load(f)
  27. except IOError:
  28. pass
  29. # Check if the build is up to date
  30. if library_manifest and manifest['version'] == library_manifest['version']:
  31. continue
  32. # Build repo
  33. print()
  34. print(f"Building {slug}")
  35. try:
  36. build.build(plugin_dir)
  37. except Exception as e:
  38. print(e)
  39. print(f"{slug} build failed")
  40. input()
  41. continue
  42. # Copy manifest
  43. with open(library_manifest_filename, "w") as f:
  44. json.dump(manifest, f, indent=" ")
  45. built_slugs.append(slug)
  46. # Open plugin issue thread
  47. os.system(f"qutebrowser \"https://github.com/VCVRack/library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+in%3Atitle+{slug}\" &")
  48. if not built_slugs:
  49. raise Exception("Nothing to build")
  50. # Upload packages
  51. build.system("cd ../packages && make upload")
  52. # Commit repository
  53. build.system("git add manifests")
  54. built_slugs_list = ", ".join(built_slugs)
  55. build.system(f"git commit -m 'Update build for {built_slugs_list}'")
  56. build.system("git push")
  57. print()
  58. print("Built " + ", ".join(built_slugs))