(self, binary=None, homedir=None, verbose=False,
                 use_agent=False, keyring=None, secring=None,
                 ignore_homedir_permissions=False, options=None)
Initialize a GnuPG process wrapper.

        :param str binary: Name for GnuPG binary executable. If the absolute
                           path is not given, the environment variable
                           ``$PATH`` is searched for the executable and
                           checked that the real uid/gid of the user has
                           sufficient permissions.

        :param str homedir: Full pathname to directory containing the public
                            and private keyrings. Default is
                            `~/.config/python-gnupg`.

        :type ignore_homedir_permissions: :obj:`bool`
        :param ignore_homedir_permissions: If true, bypass check that homedir
                                           be writable.

        :type verbose: :obj:`str` or :obj:`int` or :obj:`bool`
        :param verbose: String or numeric value to pass to GnuPG's
                        ``--debug-level`` option. See the GnuPG man page for
                        the list of valid options. If False, debug output is
                        not generated by the GnuPG binary. If True, defaults
                        to ``--debug-level basic.``

        :param str keyring: Name of keyring file containing public key data.
                            If unspecified, defaults to :file:`pubring.gpg` in
                            the **homedir** directory.

        :param str secring: Name of alternative secret keyring file to use. If
                            left unspecified, this will default to using
                            :file:`secring.gpg` in the **homedir** directory,
                            and create that file if it does not exist.

        :param list options: A list of additional options to pass to the GnuPG
                             binary.

        :raises: A :exc:`~exceptions.RuntimeError` with explanation message
                 if there is a problem invoking GnuPG.

        Example:

        >>> import gnupg
        GnuPG logging disabled...
        >>> gpg = gnupg.GPG(homedir='doctests')
        >>> gpg.keyring
        './doctests/pubring.gpg'
        >>> gpg.secring
        './doctests/secring.gpg'
        >>> gpg.use_agent
        False
        >>> gpg.binary
        '/usr/bin/gpg'
Initialize a GnuPG process wrapper.
Initialize a GnuPG process wrapper .
def __init__(self, binary=None, homedir=None, verbose=False,
                 use_agent=False, keyring=None, secring=None,
                 ignore_homedir_permissions=False, options=None):
        """Initialize a GnuPG process wrapper.

        :param str binary: Name for GnuPG binary executable. If the absolute
                           path is not given, the environment variable
                           ``$PATH`` is searched for the executable and
                           checked that the real uid/gid of the user has
                           sufficient permissions.

        :param str homedir: Full pathname to directory containing the public
                            and private keyrings. Default is
                            `~/.config/python-gnupg`.

        :type ignore_homedir_permissions: :obj:`bool`
        :param ignore_homedir_permissions: If true, bypass check that homedir
                                           be writable.

        :type verbose: :obj:`str` or :obj:`int` or :obj:`bool`
        :param verbose: String or numeric value to pass to GnuPG's
                        ``--debug-level`` option. See the GnuPG man page for
                        the list of valid options. If False, debug output is
                        not generated by the GnuPG binary. If True, defaults
                        to ``--debug-level basic.``

        :param str keyring: Name of keyring file containing public key data.
                            If unspecified, defaults to :file:`pubring.gpg` in
                            the **homedir** directory.

        :param str secring: Name of alternative secret keyring file to use. If
                            left unspecified, this will default to using
                            :file:`secring.gpg` in the **homedir** directory,
                            and create that file if it does not exist.

        :param list options: A list of additional options to pass to the GnuPG
                             binary.

        :raises: A :exc:`~exceptions.RuntimeError` with explanation message
                 if there is a problem invoking GnuPG.

        Example:

        >>> import gnupg
        GnuPG logging disabled...
        >>> gpg = gnupg.GPG(homedir='doctests')
        >>> gpg.keyring
        './doctests/pubring.gpg'
        >>> gpg.secring
        './doctests/secring.gpg'
        >>> gpg.use_agent
        False
        >>> gpg.binary
        '/usr/bin/gpg'
        """

        super(GPG, self).__init__(
            binary=binary,
            home=homedir,
            keyring=keyring,
            secring=secring,
            options=options,
            verbose=verbose,
            use_agent=use_agent,
            ignore_homedir_permissions=ignore_homedir_permissions,
        )

        log.info(textwrap.dedent("""
        Initialised settings:
        binary: %s
        binary version: %s
        homedir: %s
        ignore_homedir_permissions: %s
        keyring: %s
        secring: %s
        default_preference_list: %s
        keyserver: %s
        options: %s
        verbose: %s
        use_agent: %s
        """ % (self.binary,
               self.binary_version,
               self.homedir,
               self.ignore_homedir_permissions,
               self.keyring,
               self.secring,
               self.default_preference_list,
               self.keyserver, self.options,
               str(self.verbose),
               str(self.use_agent))))

        self._batch_dir = os.path.join(self.homedir, 'batch-files')
        self._key_dir  = os.path.join(self.homedir, 'generated-keys')

        #: The keyring used in the most recently created batch file
        self.temp_keyring = None
        #: The secring used in the most recently created batch file
        self.temp_secring = None

        # Make sure that the trustdb exists, or else GnuPG will exit with a
        # fatal error (at least it does with GnuPG>=2.0.0):
        self.create_trustdb()

        # The --no-use-agent and --use-agent options were deprecated in GnuPG
        # 2.x, so we should set use_agent to None here to avoid having
        # GPGBase._make_args() add either one.
        if self.is_gpg2():
            self.use_agent = None
def __init__ ( self , binary = None , homedir = None , verbose = False , use_agent = False , keyring = None , secring = None , ignore_homedir_permissions = False , options = None ) : super ( GPG , self ) . __init__ ( binary = binary , home = homedir , keyring = keyring , secring = secring , options = options , verbose = verbose , use_agent = use_agent , ignore_homedir_permissions = ignore_homedir_permissions , ) log . info ( textwrap . dedent ( """
        Initialised settings:
        binary: %s
        binary version: %s
        homedir: %s
        ignore_homedir_permissions: %s
        keyring: %s
        secring: %s
        default_preference_list: %s
        keyserver: %s
        options: %s
        verbose: %s
        use_agent: %s
        """ % ( self . binary , self . binary_version , self . homedir , self . ignore_homedir_permissions , self . keyring , self . secring , self . default_preference_list , self . keyserver , self . options , str ( self . verbose ) , str ( self . use_agent ) ) ) ) self . _batch_dir = os . path . join ( self . homedir , 'batch-files' ) self . _key_dir = os . path . join ( self . homedir , 'generated-keys' ) #: The keyring used in the most recently created batch file self . temp_keyring = None #: The secring used in the most recently created batch file self . temp_secring = None # Make sure that the trustdb exists, or else GnuPG will exit with a # fatal error (at least it does with GnuPG>=2.0.0): self . create_trustdb ( ) # The --no-use-agent and --use-agent options were deprecated in GnuPG # 2.x, so we should set use_agent to None here to avoid having # GPGBase._make_args() add either one. if self . is_gpg2 ( ) : self . use_agent = None