summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
Diffstat (limited to 'apt')
-rw-r--r--apt/auth.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/apt/auth.py b/apt/auth.py
index 024f01da..04aae908 100644
--- a/apt/auth.py
+++ b/apt/auth.py
@@ -7,11 +7,11 @@
# Author: Michael Vogt <mvo@debian.org>
# Sebastian Heinlein <devel@glatzor.de>
#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -84,6 +84,7 @@ def _get_gpg_command(keyring=None):
"--trustdb-name", os.path.join(_TMPDIR, "trustdb.gpg")])
return cmd
+
def _wait_and_raise(proc):
"""Wait until the given subprocess is completed and raise a
SystemError if it failed.
@@ -92,6 +93,7 @@ def _wait_and_raise(proc):
output = proc.stdout.read()
raise SystemError("GnuPG command failed: %s" % output)
+
def add_key_from_file(filename, wait=True):
"""Import a GnuPG key file to trust repositores signed by it.
@@ -115,6 +117,7 @@ def add_key_from_file(filename, wait=True):
else:
return proc
+
def add_key_from_keyserver(keyid, keyserver, wait=True):
"""Import a GnuPG key file to trust repositores signed by it.
@@ -137,6 +140,7 @@ def add_key_from_keyserver(keyid, keyserver, wait=True):
else:
return proc
+
def add_key(content, wait=True):
"""Import a GnuPG key to trust repositores signed by it.
@@ -159,6 +163,7 @@ def add_key(content, wait=True):
else:
return proc
+
def remove_key(fingerprint, wait=True):
"""Remove a GnuPG key to no longer trust repositores signed by it.
@@ -178,6 +183,7 @@ def remove_key(fingerprint, wait=True):
else:
return proc
+
def export_key(fingerprint, wait=True):
"""Return the GnuPG key in text format.
@@ -198,6 +204,7 @@ def export_key(fingerprint, wait=True):
else:
return proc
+
def list_keys():
"""Returns a list of TrustedKey instances for each key which is
used to trust repositories.
@@ -216,6 +223,7 @@ def list_keys():
res.append(key)
return res
+
if __name__ == "__main__":
# Add some known keys we would like to see translated so that they get
# picked up by gettext