mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2026-08-15 13:03:08 +00:00
Parse long export class names
This commit is contained in:
parent
f7a9e7c0bf
commit
c0fa2dbd79
1 changed files with 22 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
# ba_meta require api 8
|
# ba_meta require api 8
|
||||||
|
from babase._meta import EXPORT_CLASS_NAME_SHORTCUTS
|
||||||
import babase
|
import babase
|
||||||
import _babase
|
import _babase
|
||||||
import bauiv1 as bui
|
import bauiv1 as bui
|
||||||
|
|
@ -40,10 +41,25 @@ HEADERS = {
|
||||||
"User-Agent": _env["user_agent_string"],
|
"User-Agent": _env["user_agent_string"],
|
||||||
}
|
}
|
||||||
PLUGIN_DIRECTORY = _env["python_directory_user"]
|
PLUGIN_DIRECTORY = _env["python_directory_user"]
|
||||||
|
_regexp_friendly_class_name_shortcut = lambda string: string.replace(".", "\.")
|
||||||
REGEXP = {
|
REGEXP = {
|
||||||
"plugin_api_version": re.compile(b"(?<=ba_meta require api )(.*)"),
|
"plugin_api_version": re.compile(b"(?<=ba_meta require api )(.*)"),
|
||||||
"plugin_entry_points": re.compile(b"(ba_meta export plugin\n+class )(.*)\\("),
|
"plugin_entry_points": re.compile(
|
||||||
"minigames": re.compile(b"(ba_meta export game\n+class )(.*)\\("),
|
bytes(
|
||||||
|
"(ba_meta export (plugin|{})\n+class )(.*)\\(".format(
|
||||||
|
_regexp_friendly_class_name_shortcut(EXPORT_CLASS_NAME_SHORTCUTS["plugin"]),
|
||||||
|
),
|
||||||
|
"utf-8"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"minigames": re.compile(
|
||||||
|
bytes(
|
||||||
|
"(ba_meta export (game|{})\n+class )(.*)\\(".format(
|
||||||
|
_regexp_friendly_class_name_shortcut(EXPORT_CLASS_NAME_SHORTCUTS["game"]),
|
||||||
|
),
|
||||||
|
"utf-8"
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
DISCORD_URL = "https://ballistica.net/discord"
|
DISCORD_URL = "https://ballistica.net/discord"
|
||||||
|
|
||||||
|
|
@ -521,8 +537,8 @@ class PluginLocal:
|
||||||
if not self._entry_points:
|
if not self._entry_points:
|
||||||
content = await self.get_content()
|
content = await self.get_content()
|
||||||
groups = REGEXP["plugin_entry_points"].findall(content)
|
groups = REGEXP["plugin_entry_points"].findall(content)
|
||||||
# Actual entry points are stored in the first index inside the matching groups.
|
# Actual entry points are stored in the last index inside the matching groups.
|
||||||
entry_points = tuple(f"{self.name}.{group[1].decode('utf-8')}" for group in groups)
|
entry_points = tuple(f"{self.name}.{group[-1].decode('utf-8')}" for group in groups)
|
||||||
self._entry_points = entry_points
|
self._entry_points = entry_points
|
||||||
return self._entry_points
|
return self._entry_points
|
||||||
|
|
||||||
|
|
@ -2419,6 +2435,8 @@ class NewAllSettingsWindow(bui.Window):
|
||||||
sel = self._audio_button
|
sel = self._audio_button
|
||||||
elif sel_name == 'Advanced':
|
elif sel_name == 'Advanced':
|
||||||
sel = self._advanced_button
|
sel = self._advanced_button
|
||||||
|
elif sel_name == "Mod Manager":
|
||||||
|
sel = self._modmgr_button
|
||||||
elif sel_name == 'Back':
|
elif sel_name == 'Back':
|
||||||
sel = self._back_button
|
sel = self._back_button
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue