コード例 #1
0
 def load_tool_from_tmp_config( self, repo, repository_id, ctx, ctx_file, work_dir ):
     tool = None
     message = ''
     tmp_tool_config = hg_util.get_named_tmpfile_from_ctx( ctx, ctx_file, work_dir )
     if tmp_tool_config:
         tool_element, error_message = xml_util.parse_xml( tmp_tool_config )
         if tool_element is None:
             return tool, message
         # Look for external files required by the tool config.
         tmp_code_files = []
         external_paths = Tool.get_externally_referenced_paths( tmp_tool_config )
         for path in external_paths:
             tmp_code_file_name = hg_util.copy_file_from_manifest( repo, ctx, path, work_dir )
             if tmp_code_file_name:
                 tmp_code_files.append( tmp_code_file_name )
         tool, valid, message = self.load_tool_from_config( repository_id, tmp_tool_config )
         for tmp_code_file in tmp_code_files:
             try:
                 os.unlink( tmp_code_file )
             except:
                 pass
         try:
             os.unlink( tmp_tool_config )
         except:
             pass
     return tool, message
コード例 #2
0
def __external_files(contents):
    base_path = tempfile.mkdtemp()
    try:
        tool_path = os.path.join(base_path, "tool.xml")
        with open(tool_path, "w") as f:
            f.write(contents)
        return Tool.get_externally_referenced_paths(tool_path)
    finally:
        shutil.rmtree(base_path)
コード例 #3
0
def __external_files(contents):
    base_path = tempfile.mkdtemp()
    try:
        tool_path = os.path.join(base_path, "tool.xml")
        with open(tool_path, "w") as f:
            f.write(contents)
        return Tool.get_externally_referenced_paths(tool_path)
    finally:
        shutil.rmtree(base_path)
コード例 #4
0
 def __setup_tool(self):
     tree = parse_xml(self.tool_file)
     self.tool = Tool(self.tool_file, tree.getroot(), self.app)
     if getattr(self, "tool_action", None):
         self.tool.tool_action = self.tool_action
コード例 #5
0
 def __setup_tool(self):
     tool_source = get_tool_source(self.tool_file)
     self.tool = Tool(self.tool_file, tool_source, self.app)
     if getattr(self, "tool_action", None):
         self.tool.tool_action = self.tool_action
     return self.tool
コード例 #6
0
 def parse_inputs( self, root ):
     Tool.parse_inputs( self, root )