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


Python Project.run_preprocessors方法代碼示例

本文整理匯總了Python中chiptools.core.project.Project.run_preprocessors方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.run_preprocessors方法的具體用法?Python Project.run_preprocessors怎麽用?Python Project.run_preprocessors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在chiptools.core.project.Project的用法示例。


在下文中一共展示了Project.run_preprocessors方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_preprocessor

# 需要導入模塊: from chiptools.core.project import Project [as 別名]
# 或者: from chiptools.core.project.Project import run_preprocessors [as 別名]
 def test_preprocessor(self):
     """Invalid preprocessors should not be executed on files."""
     project = Project()
     project.load_project(self.project_path)
     files = project.get_files()
     preprocessors = list(
         filter(
             lambda x: os.path.exists(x.preprocessor), files
         )
     )
     self.assertTrue(len(preprocessors) > 0)
     project.run_preprocessors()
     regex = re.compile('library ieee;')
     for libname in self.project_structure.keys():
         files = self.project_structure[libname]
         for path in files:
             path = os.path.join(self.root, libname, path)
             with open(path, 'r') as f:
                 data = f.readlines()
                 match = regex.match(data[0])
                 self.assertIsNotNone(
                     match,
                     msg='File {0} was not correctly preserved.'.format(
                         path
                     )
                 )
開發者ID:pabennett,項目名稱:chiptools,代碼行數:28,代碼來源:test_project.py

示例2: testPreprocessor

# 需要導入模塊: from chiptools.core.project import Project [as 別名]
# 或者: from chiptools.core.project.Project import run_preprocessors [as 別名]
 def testPreprocessor(self):
     project = Project()
     XmlProjectParser.load_project(self.project_path, project)
     files = project.get_files()
     preprocessors = list(
         filter(
             lambda x: os.path.exists(x.preprocessor), files
         )
     )
     self.assertTrue(len(preprocessors) > 0)
     project.run_preprocessors()
開發者ID:hoangt,項目名稱:chiptools,代碼行數:13,代碼來源:testProjectFunctionality.py

示例3: CommandLine

# 需要導入模塊: from chiptools.core.project import Project [as 別名]
# 或者: from chiptools.core.project.Project import run_preprocessors [as 別名]

#.........這裏部分代碼省略.........

    @wraps_do_commands
    def do_synthesise(self, command):
        """Synthesise the design using the chosen synthesis tool and report any
        errors Example: (Cmd) simulate my_library.my_entity"""
        command_elems = command.split(' ')
        fpga_part = None
        if len(command_elems) == 3:
            target, tool_name, fpga_part = command_elems
        elif len(command_elems) == 2:
            target, tool_name = command_elems
        else:
            target = command_elems[0]
            tool_name = None

        try:
            library, entity = target.split('.')
        except ValueError:
            log.error('Command \"' + command + '\" not understood.')
            log.error(
                "Please specify a library and entity.\n" +
                "Example: (Cmd) synthesise my_library.my_entity [tool_name]"
            )
            return

        self.project.synthesise(
            library,
            entity,
            tool_name=tool_name,
            fpga_part=fpga_part
        )

    @wraps_do_commands
    def do_run_preprocessors(self, command):
        """For each project file in the design run any associated
        preprocessors. You can use this command to test that a preprocessor is
        running on your file correctly. Preprocessors are called automatically
        when you run synthesis"""
        log.info('Running preprocessors...')
        self.project.run_preprocessors()
        log.info('...done')

    @wraps_do_commands
    def do_simulate(self, command):
        """Compile the given entity in the given library using the chosen
        simulator and invoke the simulator GUI.
        Example: (Cmd) simulate my_library.my_entity"""
        command_elems = command.split(' ')
        if len(command_elems) == 2:
            target, tool_name = command_elems
        else:
            target = command_elems[0]
            tool_name = None

        try:
            library, entity = target.split('.')
        except ValueError:
            log.error('Command \"' + command + '\" not understood.')
            log.error(
                "Please specify a library and entity.\n" +
                "Example: (Cmd) simulate my_library.my_entity [tool_name]"
            )
            return
        self.project.simulate(library, entity, gui=True, tool_name=tool_name)

    @wraps_do_commands
開發者ID:hoangt,項目名稱:chiptools,代碼行數:70,代碼來源:cli.py


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