'Remove the file named filename from pkg_dir'

def remove_pkg_file(self, filename, pkg_dir):

    try:
        if pkg_dir.startswith('ssh://'):
            (hostline, remote_path) = parse_ssh_path(pkg_dir)
            path = os.path.join(remote_path, filename)
            utils.run(("ssh    %s    'rm    -rf    %s/%s'" % (hostline, remote_path, path)))
        else:
            os.remove(os.path.join(pkg_dir, filename))
    except (IOError, os.error) as why:
        raise error.PackageRemoveError(('Could    not    remove    %s    from    %s:    %s    ' % (filename, pkg_dir, why)))
