parameters: (cmd_type, dump)
return_statement: return values
docstring: Parses the output from dump_load_commands_macos() for macOS.
    'cmd_type' must be one of the following:
    * LC_RPATH: Returns a list containing the rpath search path, with one
      search path per entry.
    * LC_LOAD_DYLIB: Returns a list of shared object library dependencies, with
      one shared object per entry. They are returned as stored in the MachO
      header, without being first resolved to an absolute path, and may look
      like: @rpath/Foo.framework/Versions/A/Foo
    'dump' is the output from dump_load_commands_macos().
docstring_summary: Parses the output from dump_load_commands_macos() for macOS.
    'cmd_type' must be one of the following:
    * LC_RPATH: Returns a list containing the rpath search path, with one
      search path per entry.
    * LC_LOAD_DYLIB: Returns a list of shared object library dependencies, with
      one shared object per entry. They are returned as stored in the MachO
      header, without being first resolved to an absolute path, and may look
      like:
docstring_tokens: Parses the output from dump_load_commands_macos () for macOS . cmd_type must be one of the following : * LC_RPATH : Returns a list containing the rpath search path with one search path per entry . * LC_LOAD_DYLIB : Returns a list of shared object library dependencies with one shared object per entry . They are returned as stored in the MachO header without being first resolved to an absolute path and may look like :
function: def parse_load_commands_macos(cmd_type, dump):
    """
    Parses the output from dump_load_commands_macos() for macOS.
    'cmd_type' must be one of the following:
    * LC_RPATH: Returns a list containing the rpath search path, with one
      search path per entry.
    * LC_LOAD_DYLIB: Returns a list of shared object library dependencies, with
      one shared object per entry. They are returned as stored in the MachO
      header, without being first resolved to an absolute path, and may look
      like: @rpath/Foo.framework/Versions/A/Foo
    'dump' is the output from dump_load_commands_macos().
    """
    # Parsing state enum values.
    PARSING_NONE = 0
    PARSING_NEW_RECORD = 1
    PARSING_RPATH = 2
    PARSING_LIB_PATHS = 3
  
    state = PARSING_NONE
    values = []
    for line in dump:
      # Ensure the line is a string-like object.
      try:
        line = line.decode('utf-8')
      except (UnicodeDecodeError, AttributeError):
        pass
      if re.match('^Load command', line):
        state = PARSING_NEW_RECORD
        continue
      splits = re.split('\s+', line.strip(), maxsplit=2)
      key = splits[0]
      val = splits[1] if len(splits) > 1 else None
      if state == PARSING_NEW_RECORD:
        if key == KEY_CMD and val == LC_RPATH:
          state = PARSING_RPATH
          continue
        if key == KEY_CMD and val == LC_LOAD_DYLIB:
          state = PARSING_LIB_PATHS
          continue
  
      if state == PARSING_RPATH and cmd_type == LC_RPATH:
        if key == KEY_PATH:
          # Strip trailing metadata from rpath dump line.
          values.append(val)
  
      if state == PARSING_LIB_PATHS and cmd_type == LC_LOAD_DYLIB:
        if key == KEY_NAME:
          values.append(val)
    return values
function_tokens: def parse_load_commands_macos ( cmd_type , dump ) : # Parsing state enum values. PARSING_NONE = 0 PARSING_NEW_RECORD = 1 PARSING_RPATH = 2 PARSING_LIB_PATHS = 3 state = PARSING_NONE values = [ ] for line in dump : # Ensure the line is a string-like object. try : line = line . decode ( 'utf-8' ) except ( UnicodeDecodeError , AttributeError ) : pass if re . match ( '^Load command' , line ) : state = PARSING_NEW_RECORD continue splits = re . split ( '\s+' , line . strip ( ) , maxsplit = 2 ) key = splits [ 0 ] val = splits [ 1 ] if len ( splits ) > 1 else None if state == PARSING_NEW_RECORD : if key == KEY_CMD and val == LC_RPATH : state = PARSING_RPATH continue if key == KEY_CMD and val == LC_LOAD_DYLIB : state = PARSING_LIB_PATHS continue if state == PARSING_RPATH and cmd_type == LC_RPATH : if key == KEY_PATH : # Strip trailing metadata from rpath dump line. values . append ( val ) if state == PARSING_LIB_PATHS and cmd_type == LC_LOAD_DYLIB : if key == KEY_NAME : values . append ( val ) return values