diff --git a/mdk/config-dist.json b/mdk/config-dist.json index 69f8d2fc..18249834 100644 --- a/mdk/config-dist.json +++ b/mdk/config-dist.json @@ -201,6 +201,8 @@ "shifter": "/usr/bin/shifter", // Path to yuidoc "yuidoc": "/usr/local/bin/yuidoc", + // Path to ghostscript + "gs": "", // Path to your favourite editor. Set to null to guess it from the System environment. "editor": null, diff --git a/mdk/config.py b/mdk/config.py index 39afb953..be2e027d 100644 --- a/mdk/config.py +++ b/mdk/config.py @@ -26,6 +26,7 @@ import json import re import copy +from distutils.spawn import find_executable class ConfigObject(object): @@ -56,6 +57,13 @@ def get(self, name=None, default=None): break return data + def getExecutable(self, name=None, default=None): + path = self.get(name, default) + if path != None and path: + return path + path = find_executable(name) + return path + def getFlat(self, data=None, parent=''): """Return the entire data as a flat array""" flatten = {} @@ -170,6 +178,10 @@ def get(self, name=None): """Return a setting""" return self.data.get(name) + def getExecutable(self, name=None): + """Return a path to an executable""" + return self.data.getExecutable(name) + def load(self, allowMissing=False): """Loads the configuration from the config files""" diff --git a/mdk/moodle.py b/mdk/moodle.py index 16fde31f..7b8a59cd 100644 --- a/mdk/moodle.py +++ b/mdk/moodle.py @@ -338,6 +338,9 @@ def initBehat(self, switchcompletely=False, force=False, prefix=None, faildumppa elif currentWwwroot != wwwroot: logging.warning('Behat wwwroot not changed, already set to \'%s\', expected \'%s\'.' % (currentWwwroot, wwwroot)) + # Set the pathtogs as this is required by some tests. + self.updateConfig('pathtogs', C.getExecutable('gs')) + # Force a cache purge self.purge()