Exemple #1
0
def findBundleReceiptFromID(pkgid):
    '''Finds a bundle receipt in /Library/Receipts based on packageid.
    Some packages write bundle receipts under /Library/Receipts even on
    Snow Leopard; we need to be able to find them so we can remove them.
    Returns a path.'''
    if not pkgid:
        return ''
    receiptsdir = "/Library/Receipts"
    for item in munkicommon.listdir(receiptsdir):
        itempath = os.path.join(receiptsdir, item)
        if item.endswith('.pkg') and os.path.isdir(itempath):
            info = munkicommon.getOnePackageInfo(itempath)
            if info.get('packageid') == pkgid:
                return itempath

    #if we get here, not found
    return ''
def findBundleReceiptFromID(pkgid):
    '''Finds a bundle receipt in /Library/Receipts based on packageid.
    Some packages write bundle receipts under /Library/Receipts even on
    Snow Leopard; we need to be able to find them so we can remove them.
    Returns a path.'''
    if not pkgid:
        return ''
    receiptsdir = "/Library/Receipts"
    for item in munkicommon.listdir(receiptsdir):
        itempath = os.path.join(receiptsdir, item)
        if item.endswith('.pkg') and os.path.isdir(itempath):
            info = munkicommon.getOnePackageInfo(itempath)
            if info.get('packageid') == pkgid:
                return itempath

    #if we get here, not found
    return ''