parameters: (data_specs, existing, top=HERE)
return_statement: return data_files
docstring: Expand data file specs into valid data files metadata.
  
      Parameters
      ----------
      data_specs: list of tuples
          See [create_cmdclass] for description.
      existing: list of tuples
          The existing distrubution data_files metadata.
  
      Returns
      -------
      A valid list of data_files items.
docstring_summary: Expand data file specs into valid data files metadata.
docstring_tokens: Expand data file specs into valid data files metadata .
function: def _get_data_files(data_specs, existing, top=HERE):
      """Expand data file specs into valid data files metadata.
  
      Parameters
      ----------
      data_specs: list of tuples
          See [create_cmdclass] for description.
      existing: list of tuples
          The existing distrubution data_files metadata.
  
      Returns
      -------
      A valid list of data_files items.
      """
      # Extract the existing data files into a staging object.
      file_data = defaultdict(list)
      for (path, files) in existing or []:
          file_data[path] = files
  
      # Extract the files and assign them to the proper data
      # files path.
      for (path, dname, pattern) in data_specs or []:
          if os.path.isabs(dname):
              dname = os.path.relpath(dname, top)
          dname = dname.replace(os.sep, '/')
          offset = 0 if dname in ('.', '') else len(dname) + 1
          files = _get_files(_glob_pjoin(dname, pattern), top=top)
          for fname in files:
              # Normalize the path.
              root = os.path.dirname(fname)
              full_path = _glob_pjoin(path, root[offset:])
              print(dname, root, full_path, offset)
              if full_path.endswith('/'):
                  full_path = full_path[:-1]
              file_data[full_path].append(fname)
  
      # Construct the data files spec.
      data_files = []
      for (path, files) in file_data.items():
          data_files.append((path, files))
      return data_files
function_tokens: def _get_data_files ( data_specs , existing , top = HERE ) : # Extract the existing data files into a staging object. file_data = defaultdict ( list ) for ( path , files ) in existing or [ ] : file_data [ path ] = files # Extract the files and assign them to the proper data # files path. for ( path , dname , pattern ) in data_specs or [ ] : if os . path . isabs ( dname ) : dname = os . path . relpath ( dname , top ) dname = dname . replace ( os . sep , '/' ) offset = 0 if dname in ( '.' , '' ) else len ( dname ) + 1 files = _get_files ( _glob_pjoin ( dname , pattern ) , top = top ) for fname in files : # Normalize the path. root = os . path . dirname ( fname ) full_path = _glob_pjoin ( path , root [ offset : ] ) print ( dname , root , full_path , offset ) if full_path . endswith ( '/' ) : full_path = full_path [ : - 1 ] file_data [ full_path ] . append ( fname ) # Construct the data files spec. data_files = [ ] for ( path , files ) in file_data . items ( ) : data_files . append ( ( path , files ) ) return data_files