

def is_installed(pkg_name):
    '\n    Check if a package is installed.\n    '
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = run(('dpkg -s %(pkg_name)s' % locals()))
        for line in res.splitlines():
            if line.startswith('Status: '):
                status = line[8:]
                if ('installed' in status.split(' ')):
                    return True
        return False

dataset/ETHPy150Open ronnix/fabtools/fabtools/deb.py is_installed/original