(cls, trustdb=None)
Attempt to repair a broken trustdb.gpg file.

    GnuPG>=2.0.x has this magical-seeming flag: `--fix-trustdb`. You'd think
    it would fix the the trustdb. Hah! It doesn't. Here's what it does
    instead::

      (gpg)~/code/python-gnupg $ gpg2 --fix-trustdb
      gpg: You may try to re-create the trustdb using the commands:
      gpg:   cd ~/.gnupg
      gpg:   gpg2 --export-ownertrust > otrust.tmp
      gpg:   rm trustdb.gpg
      gpg:   gpg2 --import-ownertrust < otrust.tmp
      gpg: If that does not work, please consult the manual

    Brilliant piece of software engineering right there.

    :param str trustdb: The path to the trustdb.gpg file. If not given,
                        defaults to :file:`trustdb.gpg` in the current GnuPG
                        homedir.
Attempt to repair a broken trustdb.gpg file.
Attempt to repair a broken trustdb . gpg file .
def fix_trustdb(cls, trustdb=None):
    """Attempt to repair a broken trustdb.gpg file.

    GnuPG>=2.0.x has this magical-seeming flag: `--fix-trustdb`. You'd think
    it would fix the the trustdb. Hah! It doesn't. Here's what it does
    instead::

      (gpg)~/code/python-gnupg $ gpg2 --fix-trustdb
      gpg: You may try to re-create the trustdb using the commands:
      gpg:   cd ~/.gnupg
      gpg:   gpg2 --export-ownertrust > otrust.tmp
      gpg:   rm trustdb.gpg
      gpg:   gpg2 --import-ownertrust < otrust.tmp
      gpg: If that does not work, please consult the manual

    Brilliant piece of software engineering right there.

    :param str trustdb: The path to the trustdb.gpg file. If not given,
                        defaults to :file:`trustdb.gpg` in the current GnuPG
                        homedir.
    """
    if trustdb is None:
        trustdb = os.path.join(cls.homedir, 'trustdb.gpg')
    export_proc = cls._open_subprocess(['--export-ownertrust'])
    import_proc = cls._open_subprocess(['--import-ownertrust'])
    _util._threaded_copy_data(export_proc.stdout, import_proc.stdin)
    export_proc.wait()
    import_proc.wait()
def fix_trustdb ( cls , trustdb = None ) : if trustdb is None : trustdb = os . path . join ( cls . homedir , 'trustdb.gpg' ) export_proc = cls . _open_subprocess ( [ '--export-ownertrust' ] ) import_proc = cls . _open_subprocess ( [ '--import-ownertrust' ] ) _util . _threaded_copy_data ( export_proc . stdout , import_proc . stdin ) export_proc . wait ( ) import_proc . wait ( )