[Core] Add multiple/external cog paths support (#853)

* WIP cog path manager

* Initial working state

* Get real reloading working

* Type error thingy

* And fix the tests

* Start UI shit

* path reordering

* Add install path getter/setter and fix config syntax

* Determine bot directory at runtime

* Add UI commands for install path

* Update downloader to use install path

* Add sane install path default

* Make evaluation of cog install path lazy

* Some typing fixes

* Add another line to codeowners

* Conditionally put install path in paths

* Always put install path first

* Dont allow people to add the installdir as an additional path, guarantee install dir isn't shown with paths command

* Make shit update loaded cogs

* Add tests

* Another one
This commit is contained in:
Will
2017-08-10 23:09:49 -04:00
committed by GitHub
parent 0651a6ddc3
commit 13cabfbad7
8 changed files with 472 additions and 52 deletions

12
main.py
View File

@@ -1,4 +1,7 @@
from pathlib import Path
from core.bot import Red, ExitCodes
from core.cog_manager import CogManagerUI
from core.global_checks import init_global_checks
from core.events import init_events
from core.sentry_setup import init_sentry_logging
@@ -66,15 +69,22 @@ def init_loggers(cli_flags):
return logger, sentry_logger
def determine_main_folder() -> Path:
return Path(os.path.dirname(__file__)).resolve()
if __name__ == '__main__':
cli_flags = parse_cli_flags()
log, sentry_log = init_loggers(cli_flags)
description = "Red v3 - Alpha"
red = Red(cli_flags, description=description, pm_help=None)
bot_dir = determine_main_folder()
red = Red(cli_flags, description=description, pm_help=None,
bot_dir=bot_dir)
init_global_checks(red)
init_events(red, cli_flags)
red.add_cog(Core())
red.add_cog(CogManagerUI())
if cli_flags.dev:
red.add_cog(Dev())