當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。