X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/3deb2fa4815db8b8497d5cafdb94dc92717979e7..58630f7b0de796e3589d2c1eaeb3e9d531d60d37:/lib/python/Components/Task.py diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 86bd233e..2e4e757d 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -16,6 +16,7 @@ class Job(object): self.end = 100 self.__progress = 0 self.weightScale = 1 + self.afterEvent = None self.state_changed = CList() @@ -371,12 +372,18 @@ class ToolExistsPrecondition(Condition): def check(self, task): import os - self.realpath = task.cmd - path = os.environ.get('PATH', '').split(os.pathsep) - absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) - if len(absolutes) > 0: - self.realpath = task.cmd[0] - return True + if task.cmd[0]=='/': + self.realpath = task.cmd + print "[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!" + return os.access(self.realpath, os.X_OK) + else: + self.realpath = task.cmd + path = os.environ.get('PATH', '').split(os.pathsep) + path.append(task.cwd + '/') + absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) + if len(absolutes) > 0: + self.realpath = task.cmd[0] + return True return False def getErrorMessage(self, task):