當前位置: 首頁>>代碼示例>>Python>>正文


Python yum.YumBase方法代碼示例

本文整理匯總了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()') 
開發者ID:RedHatSatellite,項目名稱:satellite-demo,代碼行數:21,代碼來源:subscription_repos.py

示例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 
開發者ID:crohr,項目名稱:rpm-s3,代碼行數:25,代碼來源:merge.py

示例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) 
開發者ID:wied03,項目名稱:centos-package-cron,代碼行數:13,代碼來源:package_fetcher.py

示例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() 
開發者ID:CentOS,項目名稱:container-pipeline-service,代碼行數:8,代碼來源:yumupdates.py


注:本文中的yum.YumBase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。