home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / softwareproperties / AptAuth.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  2.7 KB  |  81 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import os
  5. import subprocess
  6. import gettext
  7. from subprocess import PIPE
  8. _ = gettext.gettext
  9.  
  10. def dummy(e):
  11.     return e
  12.  
  13. N_ = dummy
  14. N_('Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>')
  15. N_('Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>')
  16.  
  17. class AptAuth:
  18.     
  19.     def __init__(self):
  20.         self.gpg = [
  21.             '/usr/bin/gpg']
  22.         self.base_opt = self.gpg + [
  23.             '--no-options',
  24.             '--no-default-keyring',
  25.             '--secret-keyring',
  26.             '/etc/apt/secring.gpg',
  27.             '--trustdb-name',
  28.             '/etc/apt/trustdb.gpg',
  29.             '--keyring',
  30.             '/etc/apt/trusted.gpg']
  31.         self.list_opt = self.base_opt + [
  32.             '--with-colons',
  33.             '--batch',
  34.             '--list-keys']
  35.         self.rm_opt = self.base_opt + [
  36.             '--quiet',
  37.             '--batch',
  38.             '--delete-key',
  39.             '--yes']
  40.         self.add_opt = self.base_opt + [
  41.             '--quiet',
  42.             '--batch',
  43.             '--import']
  44.  
  45.     
  46.     def list(self):
  47.         res = []
  48.         p = subprocess.Popen(self.list_opt, stdout = PIPE).stdout
  49.         for line in p.readlines():
  50.             fields = line.split(':')
  51.             if fields[0] == 'pub':
  52.                 name = fields[9]
  53.                 res.append('%s %s\n%s' % (fields[4][-8:], fields[5], _(name)))
  54.                 continue
  55.         
  56.         return res
  57.  
  58.     
  59.     def add(self, filename):
  60.         cmd = self.add_opt[:]
  61.         cmd.append(filename)
  62.         p = subprocess.Popen(cmd)
  63.         return p.wait() == 0
  64.  
  65.     
  66.     def update(self):
  67.         cmd = [
  68.             '/usr/bin/apt-key',
  69.             'update']
  70.         p = subprocess.Popen(cmd)
  71.         return p.wait() == 0
  72.  
  73.     
  74.     def rm(self, key):
  75.         cmd = self.rm_opt[:]
  76.         cmd.append(key)
  77.         p = subprocess.Popen(cmd)
  78.         return p.wait() == 0
  79.  
  80.  
  81.