parameters: (self)
docstring: Process current directory for gems
  
          Note that this has to check each game project to know which gems are enabled
          and build a list of all enabled gems so that those are built.
          To debug gems output during build, use --zones=gems in your command line
docstring_summary: Process current directory for gems
docstring_tokens: Process current directory for gems
function: def process(self):
          """
          Process current directory for gems
  
          Note that this has to check each game project to know which gems are enabled
          and build a list of all enabled gems so that those are built.
          To debug gems output during build, use --zones=gems in your command line
          """
          this_path = self.ctx.get_launch_node()
  
          search_paths = [
              this_path.abspath()
          ]
          if not self.ctx.is_engine_local():
              search_paths.append(self.ctx.engine_path)
  
          for path in search_paths:
              cry_utils.append_to_unique_list(self.search_paths, os.path.normpath(path))
  
          # Parse Gems search path
          config = RawConfigParser()
          if config.read(self.ctx.get_engine_node().make_node('SetupAssistantUserPreferences.ini').abspath()):
              if config.has_section(GEMS_FOLDER) and config.has_option(GEMS_FOLDER, 'SearchPaths/size'):
                  # Parse a modified QSettings-style ini array (i.e. read 'size' attribute, then 1-based-idx/Path)
                  # The modification is that QSettings version will have single backslashes in the arrays, but we have
                  # changed it to single forward slashes.
                  array_len = config.getint(GEMS_FOLDER, 'SearchPaths/size');
                  for i in range(0, array_len):
                      new_path = config.get(GEMS_FOLDER, 'SearchPaths/{}/Path'.format(i + 1))
                      new_path = os.path.normpath(new_path)
                      Logs.debug('gems: Adding search path {}'.format(new_path))
                      cry_utils.append_to_unique_list(self.search_paths, os.path.normpath(new_path))
  
          # Load all the gems under the Gems folder to search for required gems
          self.required_gems = self.ctx.load_required_gems()
  
          game_projects = self.ctx.get_enabled_game_project_list()
  
          add_gems = False
  
          if len(game_projects)>0:
              for game_project in game_projects:
                  Logs.debug('gems: Game Project: %s' % game_project)
  
                  gems_list_file = self.ctx.get_project_node(game_project).make_node(GEMS_LIST_FILE)
  
                  if not os.path.isfile(gems_list_file.abspath()):
                      if self.ctx.is_option_true('gems_optional'):
                          Logs.debug("gems: Game has no gems file, skipping [%s]" % gems_list_file)
                          continue # go to the next game
                      else:
                          self.ctx.cry_error('Project {} is missing {} file.'.format(game_project, GEMS_LIST_FILE))
  
                  self.add_gems_from_file(gems_list_file, game_project)
                  add_gems = True
          else:
              # If there are no enabled, valid game projects, then see if we have an override gems list from the enable specs
              override_gems_list = self.ctx.get_override_gems_list()
              path_check_base = this_path.abspath()
              for override_gems_file_path in override_gems_list:
                  if not os.path.exists(os.path.join(path_check_base, override_gems_file_path)):
                      self.ctx.cry_error('Invalid override gem file {} specified in one of the enabled specs.')
                  gems_list_file = this_path.make_node(override_gems_file_path)
                  self.add_gems_from_file(gems_list_file, None)
                  add_gems = True
  
          for gem in self.gems:
              Logs.debug("gems: gem %s is used by games: %s" % (gem.name, gem.games_enabled_in))
  
          # Always add required gems to the gems manager if gems are added
          if add_gems:
              for required_gem in self.required_gems:
                  self.add_gem(required_gem)
function_tokens: def process ( self ) : this_path = self . ctx . get_launch_node ( ) search_paths = [ this_path . abspath ( ) ] if not self . ctx . is_engine_local ( ) : search_paths . append ( self . ctx . engine_path ) for path in search_paths : cry_utils . append_to_unique_list ( self . search_paths , os . path . normpath ( path ) ) # Parse Gems search path config = RawConfigParser ( ) if config . read ( self . ctx . get_engine_node ( ) . make_node ( 'SetupAssistantUserPreferences.ini' ) . abspath ( ) ) : if config . has_section ( GEMS_FOLDER ) and config . has_option ( GEMS_FOLDER , 'SearchPaths/size' ) : # Parse a modified QSettings-style ini array (i.e. read 'size' attribute, then 1-based-idx/Path) # The modification is that QSettings version will have single backslashes in the arrays, but we have # changed it to single forward slashes. array_len = config . getint ( GEMS_FOLDER , 'SearchPaths/size' ) for i in range ( 0 , array_len ) : new_path = config . get ( GEMS_FOLDER , 'SearchPaths/{}/Path' . format ( i + 1 ) ) new_path = os . path . normpath ( new_path ) Logs . debug ( 'gems: Adding search path {}' . format ( new_path ) ) cry_utils . append_to_unique_list ( self . search_paths , os . path . normpath ( new_path ) ) # Load all the gems under the Gems folder to search for required gems self . required_gems = self . ctx . load_required_gems ( ) game_projects = self . ctx . get_enabled_game_project_list ( ) add_gems = False if len ( game_projects ) > 0 : for game_project in game_projects : Logs . debug ( 'gems: Game Project: %s' % game_project ) gems_list_file = self . ctx . get_project_node ( game_project ) . make_node ( GEMS_LIST_FILE ) if not os . path . isfile ( gems_list_file . abspath ( ) ) : if self . ctx . is_option_true ( 'gems_optional' ) : Logs . debug ( "gems: Game has no gems file, skipping [%s]" % gems_list_file ) continue # go to the next game else : self . ctx . cry_error ( 'Project {} is missing {} file.' . format ( game_project , GEMS_LIST_FILE ) ) self . add_gems_from_file ( gems_list_file , game_project ) add_gems = True else : # If there are no enabled, valid game projects, then see if we have an override gems list from the enable specs override_gems_list = self . ctx . get_override_gems_list ( ) path_check_base = this_path . abspath ( ) for override_gems_file_path in override_gems_list : if not os . path . exists ( os . path . join ( path_check_base , override_gems_file_path ) ) : self . ctx . cry_error ( 'Invalid override gem file {} specified in one of the enabled specs.' ) gems_list_file = this_path . make_node ( override_gems_file_path ) self . add_gems_from_file ( gems_list_file , None ) add_gems = True for gem in self . gems : Logs . debug ( "gems: gem %s is used by games: %s" % ( gem . name , gem . games_enabled_in ) ) # Always add required gems to the gems manager if gems are added if add_gems : for required_gem in self . required_gems : self . add_gem ( required_gem )