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


Python matrix.from_file方法代码示例

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


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

示例1: main

# 需要导入模块: import matrix [as 别名]
# 或者: from matrix import from_file [as 别名]
def main():
    import jinja2
    import matrix

    print("Project path: {0}".format(base_path))

    jinja = jinja2.Environment(
        loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
        trim_blocks=True,
        lstrip_blocks=True,
        keep_trailing_newline=True
    )

    tox_environments = {}
    for (alias, conf) in matrix.from_file(join(base_path, "setup.cfg")).items():
        deps = conf["dependencies"]
        tox_environments[alias] = {
            "deps": deps.split(),
        }
        if "coverage_flags" in conf:
            cover = {"false": False, "true": True}[conf["coverage_flags"].lower()]
            tox_environments[alias].update(cover=cover)
        if "environment_variables" in conf:
            env_vars = conf["environment_variables"]
            tox_environments[alias].update(env_vars=env_vars.split())

    for name in os.listdir(join("ci", "templates")):
        with open(join(base_path, name), "w") as fh:
            fh.write(jinja.get_template(name).render(tox_environments=tox_environments))
        print("Wrote {}".format(name))
    print("DONE.") 
开发者ID:ionelmc,项目名称:python-aspectlib,代码行数:33,代码来源:bootstrap.py

示例2: main

# 需要导入模块: import matrix [as 别名]
# 或者: from matrix import from_file [as 别名]
def main():
    import jinja2
    import matrix
    import yaml

    jinja = jinja2.Environment(
        loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
        trim_blocks=True,
        lstrip_blocks=True,
        keep_trailing_newline=True
    )
    tox_environments = {}
    for name in os.listdir(join(base_path, "ci", "envs")):
        os.unlink(join(base_path, "ci", "envs", name))

    for (alias, conf) in matrix.from_file(join(base_path, "ci", "setup.cfg")).items():
        tox_environments[alias] = conf
        conf['repo_name'] = 'python-nameless'
        conf['package_name'] = 'nameless'
        conf['c_extension_test_pypi_appveyor_secret'] = 'fDwCnDhQiptm9a4ZcFpgyQ=='
        conf['c_extension_test_pypi_travis_secret'] = ''
        conf['codacy'] = 'yes'
        conf['codacy_projectid'] = '862e7946'
        conf['eabb4112be6503a667381b71'] = ''
        conf['codeclimate'] = 'yes'
        conf['codecov'] = 'yes'
        conf['coveralls'] = 'yes'
        conf['coveralls_token'] = 'IoRlAEvnKbwbhBJ2jrWPqzAnE2jobA0I3'
        conf['landscape'] = 'yes'
        conf['requiresio'] = 'yes'
        conf['scrutinizer'] = 'yes'
        with open(join(base_path, "ci", "envs", alias + '.cookiecutterrc'), "w") as fh:
            fh.write(yaml.safe_dump(
                dict(default_context={k: v for k, v in conf.items() if v}),
                default_flow_style=False
            ))
    for name in os.listdir(join(base_path, "ci", "templates")):
        with open(join(base_path, name), "w") as fh:
            fh.write(jinja.get_template(name).render(tox_environments=tox_environments))
        print("Wrote {}".format(name))
    print("DONE.") 
开发者ID:ionelmc,项目名称:cookiecutter-pylibrary,代码行数:43,代码来源:bootstrap.py


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