parameters: (self, source_path, target_path)
docstring: Copies source_path to target_path.
  
          source_path may be located inside a .whl file.
docstring_summary: Copies source_path to target_path.
docstring_tokens: Copies source_path to target_path .
function: def copy(self, source_path, target_path):
          """ Copies source_path to target_path.
  
          source_path may be located inside a .whl file. """
  
          try:
              self.announce('copying {0} -> {1}'.format(os.path.relpath(source_path, self.build_base), os.path.relpath(target_path, self.build_base)))
          except ValueError:
              # No relative path (e.g., files on different drives in Windows), just print absolute paths instead
              self.announce('copying {0} -> {1}'.format(source_path, target_path))
  
          # Make the directory if it does not yet exist.
          target_dir = os.path.dirname(target_path)
          if not os.path.isdir(target_dir):
              os.makedirs(target_dir)
  
          # Copy the file, and open it for analysis.
          if '.whl' in source_path:
              # This was found in a wheel, extract it
              whl, wf = source_path.split('.whl' + os.path.sep)
              whl += '.whl'
              whlfile = self._get_zip_file(whl)
              data = whlfile.read(wf.replace(os.path.sep, '/'))
              with open(target_path, 'wb') as f:
                  f.write(data)
          else:
              # Regular file, copy it
              shutil.copyfile(source_path, target_path)
function_tokens: def copy ( self , source_path , target_path ) : try : self . announce ( 'copying {0} -> {1}' . format ( os . path . relpath ( source_path , self . build_base ) , os . path . relpath ( target_path , self . build_base ) ) ) except ValueError : # No relative path (e.g., files on different drives in Windows), just print absolute paths instead self . announce ( 'copying {0} -> {1}' . format ( source_path , target_path ) ) # Make the directory if it does not yet exist. target_dir = os . path . dirname ( target_path ) if not os . path . isdir ( target_dir ) : os . makedirs ( target_dir ) # Copy the file, and open it for analysis. if '.whl' in source_path : # This was found in a wheel, extract it whl , wf = source_path . split ( '.whl' + os . path . sep ) whl += '.whl' whlfile = self . _get_zip_file ( whl ) data = whlfile . read ( wf . replace ( os . path . sep , '/' ) ) with open ( target_path , 'wb' ) as f : f . write ( data ) else : # Regular file, copy it shutil . copyfile ( source_path , target_path )