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


Python Env.check_manifest方法代码示例

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


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

示例1: main

# 需要导入模块: from env import Env [as 别名]
# 或者: from env.Env import check_manifest [as 别名]
def main():
    """This is the main funcion, where HDLMake starts.
    Here, we make the next processes:
        -- parse command
        -- check and set the environment
        -- prepare the global module containing the heavy common stuff
    """	


    #
    # SET & GET PARSER
    #
    parser = _get_parser()

    #
    # PARSE & GET OPTIONS
    #
    options = _get_options(sys, parser)
    global_mod.options = options


    # global_mod_assigned!!!
    env = Env(options)
    global_mod.env = env


    numeric_level = getattr(logging, options.log.upper(), None)
    if not isinstance(numeric_level, int):
        sys.exit('Invalid log level: %s' % options.log)

    logging.basicConfig(format=colored("%(levelname)s", "yellow") + colored("\t%(filename)s:%(lineno)d: %(funcName)s()\t", "blue") + "%(message)s", level=numeric_level)
    logging.debug(str(options))

    modules_pool = ModulePool()
    modules_pool.new_module(parent=None,
                            url=os.getcwd(),
                            source=fetch_mod.LOCAL,
                            fetchto=".",
                            process_manifest=False)

    # Setting top_module as top module of design (ModulePool class)
    if modules_pool.get_top_module().manifest is None:
        logging.info("No manifest found. At least an empty one is needed")
        logging.info("To see some help, type hdlmake --help")
        sys.exit("Exiting")

    # Setting global variable (global_mod.py)
    top_mod = modules_pool.get_top_module()
    global_mod.top_module = top_mod

    #global_mod.global_target = global_mod.top_module.target
    global_mod.mod_pool = modules_pool

    modules_pool.process_top_module_manifest()

    #
    # Load global tool object (global_mod.py)
    #
    if not top_mod.action:
        logging.error("`action' manifest variable has to be specified. "
                      "Otherwise hdlmake doesn't know how to handle the project")
        quit()
    if top_mod.action == "synthesis":
        if not top_mod.syn_tool:
            logging.error("`syn_tool' manifest variable has to be specified. "
                          "Otherwise hdlmake doesn't know how to synthesize the project")
            quit()
        tool_name = top_mod.syn_tool
    elif top_mod.action == "simulation":
        if not top_mod.sim_tool:
            logging.error("`sim_tool' manifest variable has to be specified. "
                          "Otherwise hdlmake doesn't know how to simulate the project")
            quit()
        tool_name = top_mod.sim_tool
    logging.info('import tool module: ' + tool_name)
    try:
        tool_module = importlib.import_module("tools.%s.%s" % (tool_name, tool_name))
    except Exception as e:
        logging.error(e)
        quit()

    global_mod.tool_module = tool_module


    #env.top_module = modules_pool.get_top_module()
    env.check_env(verbose=False)
    #env.check_env_wrt_manifest(verbose=False)


    #                                   #
    # EXECUTE THE COMMANDS/ACTIONS HERE #
    #                                   #


    if options.command == "check-env":
        env.check_env(verbose=True)
        quit()

    if options.command == "check-manifest":
        env.check_manifest(modules_pool.get_top_module().manifest, verbose=True)
#.........这里部分代码省略.........
开发者ID:darwinbeing,项目名称:hdl-make,代码行数:103,代码来源:__main__.py

示例2: main

# 需要导入模块: from env import Env [as 别名]
# 或者: from env.Env import check_manifest [as 别名]

#.........这里部分代码省略.........

    numeric_level = getattr(logging, options.log.upper(), None)
    if not isinstance(numeric_level, int):
        sys.exit('Invalid log level: %s' % options.log)

    logging.basicConfig(format=colored("%(levelname)s", "yellow") + colored("\t%(filename)s:%(lineno)d: %(funcName)s()\t", "blue") + "%(message)s", level=numeric_level)
    logging.debug(str(options))

    modules_pool = ModulePool()
    modules_pool.new_module(parent=None,
                            url=os.getcwd(),
                            source=fetch_mod.LOCAL,
                            fetchto=".",
                            process_manifest=False)

    # Setting top_module as top module of design (ModulePool class)
    if modules_pool.get_top_module().manifest is None:
        logging.info("No manifest found. At least an empty one is needed")
        logging.info("To see some help, type hdlmake --help")
        sys.exit("Exiting")

    # Setting global variable (global_mod.py)
    top_mod = modules_pool.get_top_module()
    global_mod.top_module = top_mod

    global_mod.global_target = global_mod.top_module.target
    global_mod.mod_pool = modules_pool

    # if options.command == "version":
    #     print("Hdlmake build " + BUILD_ID)
    #     quit()

    if options.command == "check-manifest":
        env.check_manifest(modules_pool.get_top_module().manifest, verbose=True)

    modules_pool.process_top_module_manifest()

    env.top_module = modules_pool.get_top_module()
    env.check_env(verbose=False)
    env.check_env_wrt_manifest(verbose=False)

    if options.command == "auto":
        logging.info("Running automatic flow.")
        if not top_mod.action:
            logging.error("`action' manifest variable has to be specified. "
                          "Otherwise hdlmake doesn't know how to handle the project")
            quit()
        if top_mod.action == "simulation":
            sim = GenerateSimulationMakefile(modules_pool=modules_pool,
                                             options=options,
                                             env=env)
            sim.run()
            quit()
        elif top_mod.action == "synthesis":
            syn = GenerateISEMakefile(modules_pool=modules_pool,
                                      options=options,
                                      env=env)
            ise = GenerateISEProject(modules_pool=modules_pool,
                                     options=options,
                                     env=env)
            remote = GenerateRemoteSynthesisMakefile(modules_pool=modules_pool,
                                                     options=options,
                                                     env=env)
            syn.run()
            ise.run()
            remote.run()
开发者ID:NickeZ,项目名称:hdl-make,代码行数:70,代码来源:__main__.py


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