本文整理匯總了Python中yum.YumBase方法的典型用法代碼示例。如果您正苦於以下問題:Python yum.YumBase方法的具體用法?Python yum.YumBase怎麽用?Python yum.YumBase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yum
的用法示例。
在下文中一共展示了yum.YumBase方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: YumSingleton
# 需要導入模塊: import yum [as 別名]
# 或者: from yum import YumBase [as 別名]
def YumSingleton():
from StringIO import StringIO
new_out = StringIO()
sav_out = (sys.stdout, sys.stderr) # save old IO
[ x.flush() for x in sav_out ] # flush output
sys.stdout = sys.stderr = new_out
ex = None
try:
yb = YumBase()
yb.conf
return yb
except Exception as x:
ex = x # save exception
finally:
new_out.flush() # grab the output
(sys.stdout, sys.stderr) = sav_out # restore it
# if we got here, then we had an error
sys.stderr.write(str(new_out))
raise ex if ex else Exception('Error creating yum.YumBase()')
示例2: __init__
# 需要導入模塊: import yum [as 別名]
# 或者: from yum import YumBase [as 別名]
def __init__(self, repolist=[], yumbase=None, mdconf=None, mdbase_class=None ):
self.repolist = repolist
self.outputdir = '%s/merged_repo' % os.getcwd()
self.exclude_tuples = []
self.sort_func = self._sort_func # callback function to magically sort pkgs
if not mdconf:
self.mdconf = createrepo.MetaDataConfig()
else:
self.mdconf = mdconf
if not mdbase_class:
self.mdbase_class = createrepo.MetaDataGenerator
else:
self.mdbase_class = mdbase_class
if not yumbase:
self.yumbase = yum.YumBase()
else:
self.yumbase = yumbase
self.yumbase.conf.cachedir = getCacheDir()
self.yumbase.conf.cache = 0
# default to all arches
self.archlist = unique(rpmUtils.arch.arches.keys() + rpmUtils.arch.arches.values())
self.groups = True
self.updateinfo = True
示例3: __init__
# 需要導入模塊: import yum [as 別名]
# 或者: from yum import YumBase [as 別名]
def __init__(self,changelog_parser,executor,repos_to_exclude=[],repos_to_include=[]):
self.changelog_parser = changelog_parser
self.yb = yum.YumBase()
self.yb.setCacheDir()
self.executor = executor
self.repos_to_exclude = repos_to_exclude
self.repos_to_include = repos_to_include
for repo in repos_to_exclude:
self.yb.repos.disableRepo(repo)
for repo in repos_to_include:
self.yb.repos.enableRepo(repo)
示例4: __init__
# 需要導入模塊: import yum [as 別名]
# 或者: from yum import YumBase [as 別名]
def __init__(self):
"""
Instantiate the YumUpdates class and creates
yum.YumBase class's object
"""
self.yum_obj = yum.YumBase()