本文整理汇总了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()