def evalTclConfigExpr(cls, platform, distroRoot, expr, description): tclConfig = cls.getTclConfig(platform, distroRoot) if tclConfig is None: return None with open('derived/tcl-search.log', 'a', encoding='utf-8') as log: print('Getting Tcl %s...' % description, file=log) text = captureStdout( log, shjoin([ 'sh', '-c', '. %s && eval "echo \\"%s\\""' % (tclConfig, expr) ])) if text is not None: print('Result: %s' % text.strip(), file=log) return None if text is None else text.strip()
def evalTclConfigExpr(cls, platform, distroRoot, expr, description): tclConfig = cls.getTclConfig(platform, distroRoot) if tclConfig is None: return None log = open('derived/tcl-search.log', 'a') try: print >> log, 'Getting Tcl %s...' % description text = captureStdout( log, shjoin([ 'sh', '-c', '. %s && eval "echo \\"%s\\""' % (tclConfig, expr) ]) ) finally: log.close() return None if text is None else text.strip()
def evalTclConfigExpr(cls, platform, distroRoot, expr, description): tclConfig = cls.getTclConfig(platform, distroRoot) if tclConfig is None: return None log = open('derived/tcl-search.log', 'a') try: print >> log, 'Getting Tcl %s...' % description text = captureStdout( log, shjoin([ 'sh', '-c', '. %s && eval "echo \\"%s\\""' % (tclConfig, expr) ]) ) if text is not None: print >> log, 'Result: %s' % text.strip() finally: log.close() return None if text is None else text.strip()
def normalizeWhitespace(expression): return shjoin(shsplit(expression))