<s> """<STR_LIT>""" <EOL> from fabric . api import hide , run , settings <EOL> from fabtools . utils import run_as_root <EOL> MANAGER = '<STR_LIT>' <EOL> def update ( kernel = False ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> cmds = { '<STR_LIT>' : { False : '<STR_LIT>' , True : '<STR_LIT>' } } <EOL> cmd = cmds [ manager ] [ kernel ] <EOL> run_as_root ( "<STR_LIT>" % locals ( ) ) <EOL> def upgrade ( kernel = False ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> cmds = { '<STR_LIT>' : { False : '<STR_LIT>' , True : '<STR_LIT>' } } <EOL> cmd = cmds [ manager ] [ kernel ] <EOL> run_as_root ( "<STR_LIT>" % locals ( ) ) <EOL> def groupupdate ( group , options = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> if options is None : <EOL> options = [ ] <EOL> elif isinstance ( options , str ) : <EOL> options = [ options ] <EOL> options = "<STR_LIT:U+0020>" . join ( options ) <EOL> run_as_root ( '<STR_LIT>' % locals ( ) ) <EOL> def is_installed ( pkg_name ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> with settings ( hide ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , warn_only = True ) : <EOL> res = run ( "<STR_LIT>" % locals ( ) ) <EOL> if res . succeeded : <EOL> return True <EOL> return False <EOL> def install ( packages , repos = None , yes = None , options = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> if options is None : <EOL> options = [ ] <EOL> elif isinstance ( options , str ) : <EOL> options = [ options ] <EOL> if not isinstance ( packages , basestring ) : <EOL> packages = "<STR_LIT:U+0020>" . join ( packages ) <EOL> if repos : <EOL> for repo in repos : <EOL> options . append ( '<STR_LIT>' % locals ( ) ) <EOL> options = "<STR_LIT:U+0020>" . join ( options ) <EOL> if isinstance ( yes , str ) : <EOL> run_as_root ( '<STR_LIT>' % locals ( ) ) <EOL> else : <EOL> run_as_root ( '<STR_LIT>' % locals ( ) ) <EOL> def groupinstall ( group , options = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> if options is None : <EOL> options = [ ] <EOL> elif isinstance ( options , str ) : <EOL> options = [ options ] <EOL> options = "<STR_LIT:U+0020>" . join ( options ) <EOL> run_as_root ( '<STR_LIT>' % locals ( ) , pty = False ) <EOL> def uninstall ( packages , options = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> if options is None : <EOL> options = [ ] <EOL> elif isinstance ( options , str ) : <EOL> options = [ options ] <EOL> if not isinstance ( packages , basestring ) : <EOL> packages = "<STR_LIT:U+0020>" . join ( packages ) <EOL> options = "<STR_LIT:U+0020>" . join ( options ) <EOL> run_as_root ( '<STR_LIT>' % locals ( ) ) <EOL> def groupuninstall ( group , options = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> if options is None : <EOL> options = [ ] <EOL> elif isinstance ( options , str ) : <EOL> options = [ options ] <EOL> options = "<STR_LIT:U+0020>" . join ( options ) <EOL> run_as_root ( '<STR_LIT>' % locals ( ) ) <EOL> def repolist ( status = '<STR_LIT>' , media = None ) : <EOL> """<STR_LIT>""" <EOL> manager = MANAGER <EOL> with settings ( hide ( '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> if media : <EOL> repos = run_as_root ( "<STR_LIT>" % locals ( ) ) <EOL> else : <EOL> repos = run_as_root ( "<STR_LIT>" % locals ( ) ) <EOL> return map ( lambda line : line . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:0> ] , repos . splitlines ( ) [ <NUM_LIT:1> : ] ) </s>
