diff options
| author | Sebastian Heinlein <devel@glatzor.de> | 2012-06-01 06:37:51 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <devel@glatzor.de> | 2012-06-01 06:37:51 +0200 |
| commit | fdae874a77c122a72d283fc13c5494b0359f6b67 (patch) | |
| tree | c2fa97fd41b7586dccdc3d267f25a471c296f18a | |
| parent | 1b18197f00a0f8b230c11dd90b6f9799ac114d55 (diff) | |
| download | python-apt-fdae874a77c122a72d283fc13c5494b0359f6b67.tar.gz | |
Add an export_key method
| -rw-r--r-- | apt/auth.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/apt/auth.py b/apt/auth.py index d6b1d97f..3b15b256 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -179,6 +179,26 @@ def remove_key(fingerprint, wait=True): else: return proc +def export_key(fingerprint, wait=True): + """Return the GnuPG key in text format. + + Keyword arguments: + fingerprint -- the fingerprint identifying the key + wait -- if the system should be blocked until the internal GnuPG is + completed. Otherwise the subprocess.Popen() instance will be + returned. By default the call will be blocking. + """ + cmd = _get_gpg_command() + cmd.extend(["--armor", "--export", fingerprint]) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True) + if wait: + _wait_and_raise(proc) + return proc.stdout.read() + else: + return proc + def list_keys(): """Returns a list of TrustedKey instances for each key which is used to trust repositories. |
