Hey look ma I can load plugins with a template!
This commit is contained in:
parent
c7e86580d4
commit
104f0c0483
@ -6,6 +6,7 @@ import yaml
|
||||
import logging
|
||||
import argparse
|
||||
import python-tool
|
||||
##PLUGIN_import importlib
|
||||
# Import your custom libraries here
|
||||
|
||||
##PLUGIN__plugin_map = {}
|
||||
|
@ -141,6 +141,11 @@ new_python_tool() {
|
||||
sed_i "s/.*##PLUGIN_\(.*\)/\1/g" ./"$NAME"/bin/"$NAME"
|
||||
mkdir ./"$NAME"/"$NAME"/plugins
|
||||
touch ./"$NAME"/"$NAME"/plugins/plugin.py
|
||||
PYTHON_TOOL_SETUP_INSTRUCTIONS+="Set your plugin class by setting the plugin_class variable in bin/$NAME and defining the class in $NAME/plugins/*.py files."
|
||||
PYTHON_TOOL_WARNINGS+="At least one .py file needs to exist in $NAME/plugins/ for the plugin directory to be packaged for install. 'plugin.py' is provided for this purpose, but can be removed if you have other plugins. The file can be empty."
|
||||
if [[ "$PYTHON_MODULE" == 'y' ]]; then
|
||||
PYTHON_TOOL_WARNINGS+="Migrating the plugin-loading logic from bin/$NAME to $NAME/$NAME.py might be a good idea if you want your plugins to be loaded as part of your library."
|
||||
fi
|
||||
else :
|
||||
sed_i 's#.*plugins.*##g' ./"$NAME"/setup.py
|
||||
sed_i "s/.*##PLUGIN_\(.*\)//g" ./"$NAME"/bin/"$NAME"
|
||||
|
Loading…
Reference in New Issue
Block a user