def prove(self, MaudeModule): """ try to locate a useful Maude install and start up a subprocess which takes our generated module as input, and naturally tries to prove it""" whichMaude = Main.which(self.defaults['Maude']) if not whichMaude: sys.stderr.write("[ERROR] excutable Maude not found \n") sys.exit(1) else: (fd, fname) = tempfile.mkstemp(suffix=".maude", prefix="monologue-", text=1) if self.defaults['print']: if self.versionCheck(whichMaude): MaudeModule = self.removePrintComments(MaudeModule) os.write(fd, MaudeModule) os.close(fd) args = [] args.append('-no-banner') args.append('-no-ansi-color') args.append(fname) child = SubProcess(whichMaude, args, self.defaults['escape'], self.defaults['timeout'], self.defaults['output']) child.start() #TODO subprocess(whichMaude, args, escape, timeout) os.unlink(fname)
def versionCheck(self, whichMaude): """ we need version 2.4 or better to do uncomment print statements """ version = SubProcess.spoof(whichMaude + " --version").strip() if re.match("^\d+\.\d+$", version): if float( version ) < 2.4: sys.stderr.write("[WARNING] your Maude version has no 'print' statement\n") return 0 else: if re.match("^alpha.*$", version): sys.stderr.write("[WARNING] your are running an Alpha version\n") sys.stderr.write("[WARNING] it may not support 'print' statement\n") sys.stderr.write("[WARNING] do this at your own risk\n") return 1