Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mdk/config-dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
12 changes: 12 additions & 0 deletions mdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import json
import re
import copy
from distutils.spawn import find_executable


class ConfigObject(object):
Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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"""

Expand Down
3 changes: 3 additions & 0 deletions mdk/moodle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down