mirror of
https://github.com/scummvm/dockerized-bb.git
synced 2026-06-20 05:46:00 +00:00
BUILDBOT: Reload modules in master.cfg
This allows buildbot reload to actually work without restarting
This commit is contained in:
1 parent
125b5036e3
commit
e209c99777
1 file changed
+23
-1
@@ -7,7 +7,29 @@
|
||||
#######
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
import importlib
|
||||
|
||||
module_path = os.path.dirname(__file__)
|
||||
sys.path.insert(0, module_path)
|
||||
|
||||
def refresh(directory):
|
||||
for module in sys.modules.values():
|
||||
try:
|
||||
f = module.__file__
|
||||
except AttributeError:
|
||||
# Some modules don't have __file__ attribute
|
||||
continue
|
||||
try:
|
||||
if os.path.commonpath([f, directory]) != directory:
|
||||
continue
|
||||
except ValueError:
|
||||
continue
|
||||
print("Reloading {0}".format(module.__name__))
|
||||
importlib.reload(module)
|
||||
|
||||
# Refresh modules inside buildbot-config to be able to refresh configuration on reload
|
||||
# Do it before importing else we will load modules twice at startup
|
||||
refresh(module_path)
|
||||
|
||||
import config
|
||||
import workers, builds, platforms, ui
|
||||
|
||||
Reference in new issue
Block a user