(binary=None)
return found
Find the absolute path to the GnuPG binary.

    Also run checks that the binary is not a symlink, and check that
    our process real uid has exec permissions.

    :param str binary: The path to the GnuPG binary.
    :raises: :exc:`~exceptions.RuntimeError` if it appears that GnuPG is not
             installed.
    :rtype: str
    :returns: The absolute path to the GnuPG binary to use, if no exceptions
              occur.
Find the absolute path to the GnuPG binary.
Find the absolute path to the GnuPG binary .
def _find_binary(binary=None):
    """Find the absolute path to the GnuPG binary.

    Also run checks that the binary is not a symlink, and check that
    our process real uid has exec permissions.

    :param str binary: The path to the GnuPG binary.
    :raises: :exc:`~exceptions.RuntimeError` if it appears that GnuPG is not
             installed.
    :rtype: str
    :returns: The absolute path to the GnuPG binary to use, if no exceptions
              occur.
    """
    found = None
    if binary is not None:
        if os.path.isabs(binary) and os.path.isfile(binary):
            return binary
        if not os.path.isabs(binary):
            try:
                found = _which(binary)
                log.debug("Found potential binary paths: %s"
                          % '\n'.join([path for path in found]))
                found = found[0]
            except IndexError as ie:
                log.info("Could not determine absolute path of binary: '%s'"
                          % binary)
        elif os.access(binary, os.X_OK):
            found = binary
    if found is None:
        try: found = _which('gpg', abspath_only=True, disallow_symlinks=True)[0]
        except IndexError as ie:
            log.error("Could not find binary for 'gpg'.")
            try: found = _which('gpg2')[0]
            except IndexError as ie:
                log.error("Could not find binary for 'gpg2'.")
    if found is None:
        raise RuntimeError("GnuPG is not installed!")

    return found
def _find_binary ( binary = None ) : found = None if binary is not None : if os . path . isabs ( binary ) and os . path . isfile ( binary ) : return binary if not os . path . isabs ( binary ) : try : found = _which ( binary ) log . debug ( "Found potential binary paths: %s" % '\n' . join ( [ path for path in found ] ) ) found = found [ 0 ] except IndexError as ie : log . info ( "Could not determine absolute path of binary: '%s'" % binary ) elif os . access ( binary , os . X_OK ) : found = binary if found is None : try : found = _which ( 'gpg' , abspath_only = True , disallow_symlinks = True ) [ 0 ] except IndexError as ie : log . error ( "Could not find binary for 'gpg'." ) try : found = _which ( 'gpg2' ) [ 0 ] except IndexError as ie : log . error ( "Could not find binary for 'gpg2'." ) if found is None : raise RuntimeError ( "GnuPG is not installed!" ) return found