def find_global_program(name): assert name != "source", "Do not use source, run .sh files instead." program_path = plcommand(name) if program_path is None: wlines = toolkit.command_output("which %s" % name) if len(wlines) != 1: raise core.PyTestUsageError( "The only global programs currently supported are those found by 'which' " "or those found in a <plearn_branch>/commands/. Call 'which %s' resulted " "in those %d lines \n%s" % (name, len(wlines), ''.join(wlines))) path = wlines[0] path = path.rstrip(' \n') if sys.platform == 'win32': # Need to convert the Cygwin path to the Windows path, otherwise # os.path.exists(path) will return False. path = toolkit.command_output("cygpath -w %s" % path) path = path[0].rstrip('\n') if toolkit.exec_path_exists(path): program_path = os.path.abspath(path) assert program_path is not None, 'Could not find global program %s' % name return program_path
def isCompilable(self): try: return self.__is_compilable except AttributeError: # Compiler must be provided only for compilable program if self.compiler: self.__is_compilable = True # Programs which doesn't exist yet are assumed to be created # through compilation elif not toolkit.exec_path_exists(self.getProgramPath()): self.__is_compilable = True # PyMake-style elif os.path.islink(self.getProgramPath()): self.__is_compilable = os.path.exists(self.getProgramPath()+".cc") # Otherwise assumed to be non-compilable else: self.__is_compilable = False # It is now cached... return self.__is_compilable
def find_global_program(name): assert name != "source", "Do not use source, run .sh files instead." program_path = plcommand(name) if program_path is None: wlines = toolkit.command_output( "which %s"%name ) if len(wlines) != 1: raise core.PyTestUsageError( "The only global programs currently supported are those found by 'which' " "or those found in a <plearn_branch>/commands/. Call 'which %s' resulted " "in those %d lines \n%s"%(name, len(wlines), ''.join(wlines)) ) path = wlines[0] path = path.rstrip(' \n') if sys.platform == 'win32': # Need to convert the Cygwin path to the Windows path, otherwise # os.path.exists(path) will return False. path = toolkit.command_output( "cygpath -w %s" % path ) path = path[0].rstrip('\n') if toolkit.exec_path_exists(path): program_path = os.path.abspath(path) assert program_path is not None, 'Could not find global program %s' % name return program_path
def isCompilable(self): try: return self.__is_compilable except AttributeError: # Compiler must be provided only for compilable program if self.compiler: self.__is_compilable = True # Programs which doesn't exist yet are assumed to be created # through compilation elif not toolkit.exec_path_exists(self.getProgramPath()): self.__is_compilable = True # PyMake-style elif os.path.islink(self.getProgramPath()): self.__is_compilable = os.path.exists(self.getProgramPath() + ".cc") # Otherwise assumed to be non-compilable else: self.__is_compilable = False # It is now cached... return self.__is_compilable