def _substituteMetaVars( s ) : if sys.platform == 'win32' : _metaDict = dict( python='python.exe', pythonw='pythonw.exe' ) else : _metaDict = dict( python='python', pythonw='python' ) _metaDict['approot'] = getAppDir() return Template( s ).safe_substitute( _metaDict )
def _substituteMetaVars( s ) : j = (lambda x : os.path.join(sys.prefix, x)) prefix = sys.prefix + os.pathsep if sys.platform == 'win32' : _metaDict = dict( python=j('python.exe'), pythonw=j('pythonw.exe' )) else : _metaDict = dict( python=j('python'), pythonw=j('python') ) _metaDict['approot'] = getAppDir() return Template( s ).safe_substitute( _metaDict )
def _runCommand( self, command, envNew ) : env = dict( os.environ.items() ) env.update( envNew ) cmdLine = [_substituteMetaVars(x) for x in command] p = os.path.join( getAppDir(), cmdLine[0] ) if not os.path.isfile(p) : p = self._findProgram( cmdLine[0] ) args = [p] + cmdLine[1:] startingDir = os.getcwd() result = spawnProcess( p, args, env, startingDir, 0 ) if not result : print 'error starting command (%s)' % p