def get_pkg_id(pkg):
    '''
    Attempt to get the package id from a .pkg file

    Returns all of the package ids if the pkg file contains multiple

    pkg
        The location of the pkg file
    '''
    pkg = _quote(pkg)
    package_ids = []

    # Create temp directory
    temp_dir = __salt__['temp.dir'](prefix='pkg-')

    try:
        # List all of the PackageInfo files
        cmd = 'xar -t -f {0} | grep PackageInfo'.format(pkg)
        out = __salt__['cmd.run'](cmd, python_shell=True, output_loglevel='quiet')
        files = out.split('\n')

        if out not in 'Error opening':
            # Extract the PackageInfo files
            cmd = 'xar -x -f {0} {1}'.format(pkg, ' '.join(files))
            __salt__['cmd.run'](cmd, cwd=temp_dir, output_loglevel='quiet')

            # Find our identifiers
            for f in files:
                i = _get_pkg_id_from_pkginfo(os.path.join(temp_dir, f))
                if len(i):
                    package_ids.extend(i)
        else:
            package_ids = _get_pkg_id_dir(pkg)

    finally:
        # Clean up
        __salt__['file.remove'](temp_dir)

    return package_ids
dataset/ETHPy150Open saltstack/salt/salt/modules/mac_package.py/get_pkg_id/swapped operands of `not in`