mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2026-08-15 13:03:08 +00:00
add powerup_manager
This commit is contained in:
parent
81d974614f
commit
b1183aadcf
3 changed files with 3000 additions and 9 deletions
|
|
@ -2365,4 +2365,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2985
plugins/utilities/powerup_manager.py
Normal file
2985
plugins/utilities/powerup_manager.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -56,8 +56,9 @@ def update_plugin_json(plugin_info, category):
|
||||||
try:
|
try:
|
||||||
# Check if plugin is already in the json
|
# Check if plugin is already in the json
|
||||||
plugin = data["plugins"][name]
|
plugin = data["plugins"][name]
|
||||||
plugman_version = int(versioning_tools.semantic_to_str(
|
plugman_version = int(
|
||||||
get_latest_version(name, category)))
|
versioning_tools.semantic_to_str(get_latest_version(name, category))
|
||||||
|
)
|
||||||
current_version = int(versioning_tools.semantic_to_str(plugin_info["version"]))
|
current_version = int(versioning_tools.semantic_to_str(plugin_info["version"]))
|
||||||
# Ensure the version is always greater from the already released version
|
# Ensure the version is always greater from the already released version
|
||||||
if current_version > plugman_version:
|
if current_version > plugman_version:
|
||||||
|
|
@ -67,6 +68,9 @@ def update_plugin_json(plugin_info, category):
|
||||||
plugin["description"] = plugin_info["description"]
|
plugin["description"] = plugin_info["description"]
|
||||||
plugin["external_url"] = plugin_info["external_url"]
|
plugin["external_url"] = plugin_info["external_url"]
|
||||||
plugin["authors"] = plugin_info["authors"]
|
plugin["authors"] = plugin_info["authors"]
|
||||||
|
# In future
|
||||||
|
# We can clear the version metadata for if current_version = plugman_version for PRs
|
||||||
|
# So that its easier to update the plugin after review without changing version
|
||||||
elif current_version <= plugman_version:
|
elif current_version <= plugman_version:
|
||||||
raise Exception("Version cant be lower or equal than the previous version.")
|
raise Exception("Version cant be lower or equal than the previous version.")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
@ -85,12 +89,12 @@ def update_plugin_json(plugin_info, category):
|
||||||
|
|
||||||
def extract_plugman(plugins):
|
def extract_plugman(plugins):
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
if "plugins"+os.sep in plugin and plugin.endswith(".py"):
|
if "plugins" + os.sep in plugin and plugin.endswith(".py"):
|
||||||
|
|
||||||
debug_print(plugin)
|
debug_print(plugin)
|
||||||
try:
|
try:
|
||||||
# Split the path and get the part after 'plugins/'
|
# Split the path and get the part after 'plugins/'
|
||||||
parts = plugin.split("plugins"+os.sep)[1].split(os.sep)
|
parts = plugin.split("plugins" + os.sep)[1].split(os.sep)
|
||||||
file_name_no_extension = plugin.split(os.sep)[-1].replace(".py", "")
|
file_name_no_extension = plugin.split(os.sep)[-1].replace(".py", "")
|
||||||
category = parts[0] # First part after plugins/
|
category = parts[0] # First part after plugins/
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
@ -120,12 +124,14 @@ def extract_plugman(plugins):
|
||||||
if kw.arg == "plugin_name":
|
if kw.arg == "plugin_name":
|
||||||
plugin_name = ast.literal_eval(kw.value)
|
plugin_name = ast.literal_eval(kw.value)
|
||||||
# some basic validation specific to plugin manager
|
# some basic validation specific to plugin manager
|
||||||
if (plugin_name != plugin_name.lower()):
|
if plugin_name != plugin_name.lower():
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Plugin name in plugman must be in snakecase.")
|
"Plugin name in plugman must be in snakecase."
|
||||||
if (plugin_name != file_name_no_extension):
|
)
|
||||||
|
if plugin_name != file_name_no_extension:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Plugin name in plugman does not match the file name.")
|
"Plugin name in plugman does not match the file name."
|
||||||
|
)
|
||||||
result[kw.arg] = ast.literal_eval(kw.value)
|
result[kw.arg] = ast.literal_eval(kw.value)
|
||||||
if category:
|
if category:
|
||||||
update_plugin_json(result, category=category)
|
update_plugin_json(result, category=category)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue