| @@ -8,6 +8,7 @@ PACKAGE_DIR = "../packages" | |||||
| def system(cmd): | def system(cmd): | ||||
| print(cmd) | |||||
| err = os.system(cmd) | err = os.system(cmd) | ||||
| if err: | if err: | ||||
| raise Exception(f"Command failed with error {err}: {cmd}") | raise Exception(f"Command failed with error {err}: {cmd}") | ||||
| @@ -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) | |||||
| @@ -3,7 +3,9 @@ import json | |||||
| import os | import os | ||||
| import glob | import glob | ||||
| for filename in glob.glob("repos/*/plugin.json"): | |||||
| filenames = sys.argv[1:] | |||||
| for filename in filenames: | |||||
| # Read plugin manifest | # Read plugin manifest | ||||
| try: | try: | ||||
| with open(filename, "r") as f: | with open(filename, "r") as f: | ||||
| @@ -13,9 +15,17 @@ for filename in glob.glob("repos/*/plugin.json"): | |||||
| print(e) | print(e) | ||||
| continue | 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}") | |||||
| @@ -63,17 +63,26 @@ for plugin_dir in plugin_dirs: | |||||
| if not built_slugs: | 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 | # Upload packages | ||||
| build.system("cd ../packages && make upload") | build.system("cd ../packages && make upload") | ||||
| # Commit repository | # Commit repository | ||||
| build.system("git add manifests") | 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") | build.system("git push") | ||||
| # Delete screenshot cache | |||||
| for slug in built_slugs: | |||||
| build.system("rm -rf '../screenshots/{slug}'") | |||||
| print() | print() | ||||
| print("Built " + ", ".join(built_slugs)) | print("Built " + ", ".join(built_slugs)) | ||||
| print("Remember to generate and upload screenshots") | |||||