def ppa(name, auto_accept=True, keyserver=None):
 assert name.startswith('ppa:')
 (user, repo) = name[4:].split('/', 2)
 release = float(distrib_release())
 if (release >= 12.04):
  repo = repo.replace('.', '_')
  auto_accept = ('--yes' if auto_accept else '')
 else:
  auto_accept = ''
 if ((not isinstance(keyserver, basestring)) and keyserver):
  keyserver = keyserver[0]
 if keyserver:
  keyserver = ('--keyserver ' + keyserver)
 else:
  keyserver = ''
 distrib = distrib_codename()
 source = ('/etc/apt/sources.list.d/%(user)s-%(repo)s-%(distrib)s.list' % locals())
 if (not is_file(source)):
  if (release >= 14.04):
   package('software-properties-common')
  else:
   package('python-software-properties')
  run_as_root(('add-apt-repository %(auto_accept)s %(keyserver)s %(name)s' % locals()), pty=False)
  update_index()

def ppa ( name , auto_accept = True , keyserver = None ) : assert name . startswith ( 'ppa:' ) ( user , repo ) = name [ 4 : ] . split ( '/' , 2 ) release = float ( distrib_release ( ) ) if ( release >= 12.04 ) : repo = repo . replace ( '.' , '_' ) auto_accept = ( '--yes' if auto_accept else '' ) else : auto_accept = '' if ( ( not isinstance ( keyserver , basestring ) ) and keyserver ) : keyserver = keyserver [ 0 ] if keyserver : keyserver = ( '--keyserver ' + keyserver ) else : keyserver = '' distrib = distrib_codename ( ) source = ( '/etc/apt/sources.list.d/%(user)s-%(repo)s-%(distrib)s.list' % locals ( ) ) if ( not is_file ( source ) ) : if ( release >= 14.04 ) : package ( 'software-properties-common' ) else : package ( 'python-software-properties' ) run_as_root ( ( 'add-apt-repository %(auto_accept)s %(keyserver)s %(name)s' % locals ( ) ) , pty = False ) update_index ( )
require a ppa_ package source .