'Make a (symbolic) link called targetpath. If it cannot be created
(platform limitation), we try to make a copy of the referenced file
instead of a link.'

def makelink(self, tarinfo, targetpath):

    try:
        if tarinfo.issym():
            os.symlink(tarinfo.linkname, targetpath)
        elif os.path.exists(tarinfo._link_target):
            os.link(tarinfo._link_target, targetpath)
        else:
            self._extract_member(self._find_link_target(tarinfo), targetpath)
    except symlink_exception:
        if tarinfo.issym():
            linkpath = os.path.join(os.path.dirname(tarinfo.name), tarinfo.linkname)
        else:
            linkpath = tarinfo.linkname
    else:
        try:
            self._extract_member(self._find_link_target(tarinfo), targetpath)
        except KeyError:
            raise ExtractError('unable    to    resolve    link    inside    archive')
