Merge branch 'master' of github.com:carlroth/OpenNetworkLinux

This commit is contained in:
Jeffrey Townsend
2016-11-30 19:26:39 +00:00
2 changed files with 21 additions and 0 deletions

View File

@@ -438,10 +438,12 @@ class Base:
def loadPlugins(self):
# scrape any plugins from the installer working directory
pat = os.path.join(self.im.installerConf.installer_dir, "plugins", "*.py")
for src in glob.glob(pat):
self.loadPluginsFromFile(src)
# scrape any plugins from the installer archive
pat = "plugins/*.py"
for basename in self.zf.namelist():
if not fnmatch.fnmatch(basename, pat): continue
@@ -457,6 +459,18 @@ class Base:
if src and os.path.exists(src):
os.unlink(src)
# scrape plugins from the loader runtime
# (any plugins dropped into $pydir/onl/install/plugins/*.py)
try:
import onl.install.plugins
plugindir = os.path.dirname(onl.install.plugins.__file__)
except ImportError:
plugindir = None
if plugindir:
pat = os.path.join(plugindir, "*.py")
for src in glob.glob(pat):
self.loadPluginsFromFile(src)
return 0
def runPlugins(self, mode):

View File

@@ -0,0 +1,7 @@
"""__init__.py
Module init for installer plugins.
DO NOT auto-load modules from here.
Rather, drop files here so they will be processed by the installer.
"""