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


Python build_clib.build_clib方法代码示例

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


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

示例1: test_get_source_files

# 需要导入模块: from distutils.command import build_clib [as 别名]
# 或者: from distutils.command.build_clib import build_clib [as 别名]
def test_get_source_files(self):
        pkg_dir, dist = self.create_dist()
        cmd = build_clib(dist)

        # "in 'libraries' option 'sources' must be present and must be
        # a list of source filenames
        cmd.libraries = [('name', {})]
        self.assertRaises(DistutilsSetupError, cmd.get_source_files)

        cmd.libraries = [('name', {'sources': 1})]
        self.assertRaises(DistutilsSetupError, cmd.get_source_files)

        cmd.libraries = [('name', {'sources': ['a', 'b']})]
        self.assertEqual(cmd.get_source_files(), ['a', 'b'])

        cmd.libraries = [('name', {'sources': ('a', 'b')})]
        self.assertEqual(cmd.get_source_files(), ['a', 'b'])

        cmd.libraries = [('name', {'sources': ('a', 'b')}),
                         ('name2', {'sources': ['c', 'd']})]
        self.assertEqual(cmd.get_source_files(), ['a', 'b', 'c', 'd']) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:test_build_clib.py

示例2: test_build_libraries

# 需要导入模块: from distutils.command import build_clib [as 别名]
# 或者: from distutils.command.build_clib import build_clib [as 别名]
def test_build_libraries(self):

        pkg_dir, dist = self.create_dist()
        cmd = build_clib(dist)
        class FakeCompiler:
            def compile(*args, **kw):
                pass
            create_static_lib = compile

        cmd.compiler = FakeCompiler()

        # build_libraries is also doing a bit of typo checking
        lib = [('name', {'sources': 'notvalid'})]
        self.assertRaises(DistutilsSetupError, cmd.build_libraries, lib)

        lib = [('name', {'sources': list()})]
        cmd.build_libraries(lib)

        lib = [('name', {'sources': tuple()})]
        cmd.build_libraries(lib) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:test_build_clib.py

示例3: test_build_libraries

# 需要导入模块: from distutils.command import build_clib [as 别名]
# 或者: from distutils.command.build_clib import build_clib [as 别名]
def test_build_libraries(self):

        pkg_dir, dist = self.create_dist()
        cmd = build_clib(dist)
        class FakeCompiler:
            def compile(*args, **kw):
                pass
            create_static_lib = compile

        cmd.compiler = FakeCompiler()

        # build_libraries is also doing a bit of typoe checking
        lib = [('name', {'sources': 'notvalid'})]
        self.assertRaises(DistutilsSetupError, cmd.build_libraries, lib)

        lib = [('name', {'sources': list()})]
        cmd.build_libraries(lib)

        lib = [('name', {'sources': tuple()})]
        cmd.build_libraries(lib) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:22,代码来源:test_build_clib.py

示例4: test_run

# 需要导入模块: from distutils.command import build_clib [as 别名]
# 或者: from distutils.command.build_clib import build_clib [as 别名]
def test_run(self):
        pkg_dir, dist = self.create_dist()
        cmd = build_clib(dist)

        foo_c = os.path.join(pkg_dir, 'foo.c')
        self.write_file(foo_c, 'int main(void) { return 1;}\n')
        cmd.libraries = [('foo', {'sources': [foo_c]})]

        build_temp = os.path.join(pkg_dir, 'build')
        os.mkdir(build_temp)
        cmd.build_temp = build_temp
        cmd.build_clib = build_temp

        # Before we run the command, we want to make sure
        # all commands are present on the system.
        ccmd = missing_compiler_executable()
        if ccmd is not None:
            self.skipTest('The %r command is not found' % ccmd)

        # this should work
        cmd.run()

        # let's check the result
        self.assertIn('libfoo.a', os.listdir(build_temp)) 
开发者ID:CedricGuillemet,项目名称:Imogen,代码行数:26,代码来源:test_build_clib.py

示例5: test_check_library_dist

# 需要导入模块: from distutils.command import build_clib [as 别名]
# 或者: from distutils.command.build_clib import build_clib [as 别名]
def test_check_library_dist(self):
        pkg_dir, dist = self.create_dist()
        cmd = build_clib(dist)

        # 'libraries' option must be a list
        self.assertRaises(DistutilsSetupError, cmd.check_library_list, 'foo')

        # each element of 'libraries' must a 2-tuple
        self.assertRaises(DistutilsSetupError, cmd.check_library_list,
                          ['foo1', 'foo2'])

        # first element of each tuple in 'libraries'
        # must be a string (the library name)
        self.assertRaises(DistutilsSetupError, cmd.check_library_list,
                          [(1, 'foo1'), ('name', 'foo2')])

        # library name may not contain directory separators
        self.assertRaises(DistutilsSetupError, cmd.check_library_list,
                          [('name', 'foo1'),
                           ('another/name', 'foo2')])

        # second element of each tuple must be a dictionary (build info)
        self.assertRaises(DistutilsSetupError, cmd.check_library_list,
                          [('name', {}),
                           ('another', 'foo2')])

        # those work
        libs = [('name', {}), ('name', {'ok': 'good'})]
        cmd.check_library_list(libs) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:31,代码来源:test_build_clib.py


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