diff --git a/iolite_plugins/update_build_metadata.py b/iolite_plugins/update_build_metadata.py index 7b67ac8..f90240d 100644 --- a/iolite_plugins/update_build_metadata.py +++ b/iolite_plugins/update_build_metadata.py @@ -19,8 +19,9 @@ def hash_djb2(b): ] platforms = [("windows", "dll"), ("linux", "so")] - for plat in platforms: + any_plugin_found = False + for p in plugins: dll_filepath = "{}/{}.{}".format(plat[0], p["filename"], plat[1]) json_filepath = "{}/plugins.json".format(plat[0]) @@ -31,6 +32,13 @@ def hash_djb2(b): checksum = hash_djb2(plugin_data) checksum_with_salt = hash_djb2(bytes("{}{}".format(checksum, sys.argv[1]), "ascii")) p["checksum"] = checksum_with_salt - - with open(json_filepath, "w") as plugins_json: - json.dump(plugins, plugins_json, indent=2) + any_plugin_found = True + else: + print("Plugin '{}' not found. Skipping checksum generation...".format(dll_filepath)) + + # Only write the file if we've found at least one of the plugins + if any_plugin_found: + with open(json_filepath, "w") as plugins_json: + json.dump(plugins, plugins_json, indent=2) + else: + print("No plugins found for platform '{}'. Not writing 'plugins.json' file...".format(plat[0]))