当前位置: 首页>>代码示例>>Python>>正文


Python Depends.profiles方法代码示例

本文整理汇总了Python中bindep.depends.Depends.profiles方法的典型用法代码示例。如果您正苦于以下问题:Python Depends.profiles方法的具体用法?Python Depends.profiles怎么用?Python Depends.profiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bindep.depends.Depends的用法示例。


在下文中一共展示了Depends.profiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_finds_profiles

# 需要导入模块: from bindep.depends import Depends [as 别名]
# 或者: from bindep.depends.Depends import profiles [as 别名]
 def test_finds_profiles(self):
     depends = Depends(dedent("""\
         foo
         bar [something]
         quux [anotherthing !nothing] <=12
         """))
     self.assertThat(
         depends.profiles(),
         MatchesSetwise(*map(
             Equals, ["something", "anotherthing", "nothing"])))
开发者ID:openstack-infra,项目名称:bindep,代码行数:12,代码来源:test_depends.py

示例2: main

# 需要导入模块: from bindep.depends import Depends [as 别名]
# 或者: from bindep.depends.Depends import profiles [as 别名]
def main(depends=None):
    if depends is None:
        try:
            content = open("other-requirements.txt", "rt").read()
        except IOError:
            logging.error("No other-requirements.txt file found.")
            return 1
        depends = Depends(content)
    parser = optparse.OptionParser()
    parser.add_option("--profiles", action="store_true", help="List the platform and configuration profiles.")
    opts, args = parser.parse_args()
    if opts.profiles:
        logging.info("Platform profiles:")
        for profile in depends.platform_profiles():
            logging.info("%s", profile)
        logging.info("")
        logging.info("Configuration profiles:")
        for profile in depends.profiles():
            logging.info("%s", profile)
    else:
        if args:
            profiles = args
        else:
            profiles = ["default"]
        profiles = profiles + depends.platform_profiles()
        rules = depends.active_rules(profiles)
        errors = depends.check_rules(rules)
        for error in errors:
            if error[0] == "missing":
                logging.info("Missing packages:")
                logging.info("    %s", " ".join(error[1]))
            if error[0] == "badversion":
                logging.info("Bad versions of installed packages:")
                for pkg, constraint, version in error[1]:
                    logging.info("    %s version %s does not match %s", pkg, version, constraint)
        if errors:
            return 1
    return 0
开发者ID:pombredanne,项目名称:bindep,代码行数:40,代码来源:main.py

示例3: test_3tuple

# 需要导入模块: from bindep.depends import Depends [as 别名]
# 或者: from bindep.depends.Depends import profiles [as 别名]
 def test_3tuple(self):
     depends = Depends(u"erlang [(infra rabbitmq hipe)]\n")
     self.assertEqual(sorted([u'infra', u'rabbitmq', u'hipe']),
                      depends.profiles())
开发者ID:openstack-infra,项目名称:bindep,代码行数:6,代码来源:test_depends.py

示例4: test_empty_file

# 需要导入模块: from bindep.depends import Depends [as 别名]
# 或者: from bindep.depends.Depends import profiles [as 别名]
 def test_empty_file(self):
     depends = Depends("")
     self.assertEqual([], depends.profiles())
开发者ID:openstack-infra,项目名称:bindep,代码行数:5,代码来源:test_depends.py


注:本文中的bindep.depends.Depends.profiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。