diff --git a/scripts/build.py b/scripts/build.py index c4bf91a9..bcf588f8 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -8,6 +8,7 @@ PACKAGE_DIR = "../packages" def system(cmd): + print(cmd) err = os.system(cmd) if err: raise Exception(f"Command failed with error {err}: {cmd}") diff --git a/scripts/collect_latest.py b/scripts/collect_latest.py new file mode 100644 index 00000000..c94fcf73 --- /dev/null +++ b/scripts/collect_latest.py @@ -0,0 +1,31 @@ +import sys +import os +import glob +import json + + +def system(cmd): + if os.system(cmd): + raise Exception(f"Failed command: {cmd}") + + +PACKAGES_DIR = '../packages' +DOWNLOADS_DIR = '../downloads' + + +for manifest_filename in glob.glob('manifests/*.json'): + slug = os.path.splitext(os.path.basename(manifest_filename))[0] + with open(manifest_filename, "r") as f: + manifest = json.load(f) + + if 'version' not in manifest: + continue + + version = manifest['version'] + arch = 'win' + package_filename = os.path.join(PACKAGES_DIR, f"{slug}-{version}-{arch}.zip") + + try: + system(f'cp {package_filename} {DOWNLOADS_DIR}') + except Exception as e: + print(e) diff --git a/scripts/collect_manifests.py b/scripts/collect_manifests.py index 12cbc6be..695b4163 100644 --- a/scripts/collect_manifests.py +++ b/scripts/collect_manifests.py @@ -3,7 +3,9 @@ import json import os import glob -for filename in glob.glob("repos/*/plugin.json"): +filenames = sys.argv[1:] + +for filename in filenames: # Read plugin manifest try: with open(filename, "r") as f: @@ -13,9 +15,17 @@ for filename in glob.glob("repos/*/plugin.json"): print(e) continue - # Write library manifest - slug = manifest["slug"] - manifest_filename = f"manifests/{slug}.json" - with open(manifest_filename, "w") as f: - json.dump(manifest, f, indent=" ") - print(f"Copied {slug}") + slug = os.path.splitext(os.path.basename(filename))[0] + # dest_filename = f"manifests/{slug}.json" + # if os.path.isfile(dest_filename): + # continue + + if manifest.get('manualUrl', '') and manifest.get('pluginUrl', '') and manifest.get('author', '') and manifest.get('authorEmail', '') and manifest.get('authorUrl', '') and manifest.get('sourceUrl', '') and manifest.get('donateUrl', ''): + print(slug) + + # # Write library manifest + # slug = manifest["slug"] + # manifest_filename = f"manifests/{slug}.json" + # with open(manifest_filename, "w") as f: + # json.dump(manifest, f, indent=" ") + # print(f"Copied {slug}") diff --git a/scripts/update_builds.py b/scripts/update_builds.py index aa7a336a..5061a1e3 100644 --- a/scripts/update_builds.py +++ b/scripts/update_builds.py @@ -63,17 +63,26 @@ for plugin_dir in plugin_dirs: if not built_slugs: - raise Exception("Nothing to build") + print("Nothing to build") + exit(0) + + +print("Press enter to upload packages and push library repo") +input() # Upload packages build.system("cd ../packages && make upload") # Commit repository build.system("git add manifests") -built_slugs_list = ", ".join(built_slugs) -build.system(f"git commit -m 'Update build for {built_slugs_list}'") +built_slugs_str = ", ".join(built_slugs) +build.system(f"git commit -m 'Update build for {built_slugs_str}'") build.system("git push") +# Delete screenshot cache +for slug in built_slugs: + build.system("rm -rf '../screenshots/{slug}'") print() print("Built " + ", ".join(built_slugs)) +print("Remember to generate and upload screenshots")