'Copy metadata (egg info) to the target_dir'

def copy_metadata_to(self, target_dir):

    norm_egg_info = os.path.normpath(self.egg_info)
    prefix = os.path.join(norm_egg_info, '')
    for path in self.ei_cmd.filelist.files:
        if path.startswith(prefix):
            target = os.path.join(target_dir, path[len(prefix):])
            ensure_directory(target)
            self.copy_file(path, target)
