Пример #1
0
  def updateTools(self, files, path):

    # Loop over all tools.
    for tool in files.tools:

      # Do not attempt to parse the gknoConfiguration configuration file, since this does not represent a tool.
      if tool != 'gknoConfiguration':
        toolData                  = tc.toolConfiguration()
        toolData.allowTermination = False
  
        # Get the filename of the tool.
        filename = str(path + '/' + tool + '.json')
  
        # Get the configuration file data.
        toolData.getConfigurationData(tool, filename)
        if not toolData.success:
          print('Tool:', tool, 'could not be parsed.')
          sys.stdout.flush()

        # Get all required information.
        elif toolData.webPage:
          webInfo = toolData.webPage
          lower   = str(webInfo['tool']).lower()

          # If this is the first time the tool is observed, add it to the self.toolInformation information.
          if str(lower) not in self.toolInformation: self.toolInformation[lower] = {}

          # Add information to the tool.
          for attribute in webInfo:
            if attribute != 'tool':
              if attribute not in self.toolInformation[lower]: self.toolInformation[lower][str(attribute)] = []

              # Loop over all entries in the list.
              for value in webInfo[attribute]: self.toolInformation[lower][attribute].append(value)
Пример #2
0
  def addTools(self, files, gknoPath, userPath):
    for tool in self.getTools():
      toolData = toolConfiguration.toolConfiguration()

      # First check to see if a configuration file of this name is available in the user defined
      # configuration files directory, if specified.
      isTool = False
      if tool in files.userConfigurationFiles:
        filename = str(userPath + '/' + tool + '.json')
        isTool   = toolData.checkConfigurationFile(filename)

      # If the tool is not available in the user defined path, default to the standard gkno path.
      if not isTool: filename = str(gknoPath + '/' + tool + '.json')

      # Check that the tool exists. If not, terminate since the configuration file will not be found.
      if tool not in files.tools: self.pipelineErrors.invalidTool(tool)

      # Get the configuration file data.
      toolData.getConfigurationData(tool, filename)
      self.toolConfigurationData[tool] = toolData