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


Python support.DummyCommand方法代码示例

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


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

示例1: test_default_settings

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_default_settings(self):
        dist = Distribution()
        dist.command_obj["build"] = support.DummyCommand(
            build_scripts="/foo/bar")
        dist.command_obj["install"] = support.DummyCommand(
            install_scripts="/splat/funk",
            force=1,
            skip_build=1,
            )
        cmd = install_scripts(dist)
        self.assertFalse(cmd.force)
        self.assertFalse(cmd.skip_build)
        self.assertIsNone(cmd.build_dir)
        self.assertIsNone(cmd.install_dir)

        cmd.finalize_options()

        self.assertTrue(cmd.force)
        self.assertTrue(cmd.skip_build)
        self.assertEqual(cmd.build_dir, "/foo/bar")
        self.assertEqual(cmd.install_dir, "/splat/funk") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:test_install_scripts.py

示例2: test_default_settings

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_default_settings(self):
        dist = Distribution()
        dist.command_obj["build"] = support.DummyCommand(
            build_scripts="/foo/bar")
        dist.command_obj["install"] = support.DummyCommand(
            install_scripts="/splat/funk",
            force=1,
            skip_build=1,
            )
        cmd = install_scripts(dist)
        self.assertTrue(not cmd.force)
        self.assertTrue(not cmd.skip_build)
        self.assertTrue(cmd.build_dir is None)
        self.assertTrue(cmd.install_dir is None)

        cmd.finalize_options()

        self.assertTrue(cmd.force)
        self.assertTrue(cmd.skip_build)
        self.assertEqual(cmd.build_dir, "/foo/bar")
        self.assertEqual(cmd.install_dir, "/splat/funk") 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:test_install_scripts.py

示例3: test_default_settings

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_default_settings(self):
        dist = Distribution()
        dist.command_obj["build"] = support.DummyCommand(
            build_scripts="/foo/bar")
        dist.command_obj["install"] = support.DummyCommand(
            install_scripts="/splat/funk",
            force=1,
            skip_build=1,
            )
        cmd = install_scripts(dist)
        self.assert_(not cmd.force)
        self.assert_(not cmd.skip_build)
        self.assert_(cmd.build_dir is None)
        self.assert_(cmd.install_dir is None)

        cmd.finalize_options()

        self.assert_(cmd.force)
        self.assert_(cmd.skip_build)
        self.assertEqual(cmd.build_dir, "/foo/bar")
        self.assertEqual(cmd.install_dir, "/splat/funk") 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:23,代码来源:test_install_scripts.py

示例4: test_installation

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_installation(self):
        source = self.mkdtemp()
        expected = []

        def write_script(name, text):
            expected.append(name)
            f = open(os.path.join(source, name), "w")
            try:
                f.write(text)
            finally:
                f.close()

        write_script("script1.py", ("#! /usr/bin/env python2.3\n"
                                    "# bogus script w/ Python sh-bang\n"
                                    "pass\n"))
        write_script("script2.py", ("#!/usr/bin/python\n"
                                    "# bogus script w/ Python sh-bang\n"
                                    "pass\n"))
        write_script("shell.sh", ("#!/bin/sh\n"
                                  "# bogus shell script w/ sh-bang\n"
                                  "exit 0\n"))

        target = self.mkdtemp()
        dist = Distribution()
        dist.command_obj["build"] = support.DummyCommand(build_scripts=source)
        dist.command_obj["install"] = support.DummyCommand(
            install_scripts=target,
            force=1,
            skip_build=1,
            )
        cmd = install_scripts(dist)
        cmd.finalize_options()
        cmd.run()

        installed = os.listdir(target)
        for name in expected:
            self.assertIn(name, installed) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:39,代码来源:test_install_scripts.py

示例5: get_build_scripts_cmd

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def get_build_scripts_cmd(self, target, scripts):
        import sys
        dist = Distribution()
        dist.scripts = scripts
        dist.command_obj["build"] = support.DummyCommand(
            build_scripts=target,
            force=1,
            executable=sys.executable
            )
        return build_scripts(dist) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_build_scripts.py

示例6: test_home_installation_scheme

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_home_installation_scheme(self):
        # This ensure two things:
        # - that --home generates the desired set of directory names
        # - test --home is supported on all platforms
        builddir = self.mkdtemp()
        destination = os.path.join(builddir, "installation")

        dist = Distribution({"name": "foopkg"})
        # script_name need not exist, it just need to be initialized
        dist.script_name = os.path.join(builddir, "setup.py")
        dist.command_obj["build"] = support.DummyCommand(
            build_base=builddir,
            build_lib=os.path.join(builddir, "lib"),
            )

        cmd = install(dist)
        cmd.home = destination
        cmd.ensure_finalized()

        self.assertEqual(cmd.install_base, destination)
        self.assertEqual(cmd.install_platbase, destination)

        def check_path(got, expected):
            got = os.path.normpath(got)
            expected = os.path.normpath(expected)
            self.assertEqual(got, expected)

        libdir = os.path.join(destination, "lib", "python")
        check_path(cmd.install_lib, libdir)
        check_path(cmd.install_platlib, libdir)
        check_path(cmd.install_purelib, libdir)
        check_path(cmd.install_headers,
                   os.path.join(destination, "include", "python", "foopkg"))
        check_path(cmd.install_scripts, os.path.join(destination, "bin"))
        check_path(cmd.install_data, destination) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:37,代码来源:test_install.py

示例7: test_installation

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def test_installation(self):
        source = self.mkdtemp()
        expected = []

        def write_script(name, text):
            expected.append(name)
            f = open(os.path.join(source, name), "w")
            try:
                f.write(text)
            finally:
                f.close()

        write_script("script1.py", ("#! /usr/bin/env python2.3\n"
                                    "# bogus script w/ Python sh-bang\n"
                                    "pass\n"))
        write_script("script2.py", ("#!/usr/bin/python\n"
                                    "# bogus script w/ Python sh-bang\n"
                                    "pass\n"))
        write_script("shell.sh", ("#!/bin/sh\n"
                                  "# bogus shell script w/ sh-bang\n"
                                  "exit 0\n"))

        target = self.mkdtemp()
        dist = Distribution()
        dist.command_obj["build"] = support.DummyCommand(build_scripts=source)
        dist.command_obj["install"] = support.DummyCommand(
            install_scripts=target,
            force=1,
            skip_build=1,
            )
        cmd = install_scripts(dist)
        cmd.finalize_options()
        cmd.run()

        installed = os.listdir(target)
        for name in expected:
            self.assertTrue(name in installed) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:39,代码来源:test_install_scripts.py

示例8: _setup_package_data

# 需要导入模块: from distutils.tests import support [as 别名]
# 或者: from distutils.tests.support import DummyCommand [as 别名]
def _setup_package_data(self):
        sources = self.mkdtemp()
        f = open(os.path.join(sources, "__init__.py"), "w")
        try:
            f.write("# Pretend this is a package.")
        finally:
            f.close()
        f = open(os.path.join(sources, "README.txt"), "w")
        try:
            f.write("Info about this package")
        finally:
            f.close()

        destination = self.mkdtemp()

        dist = Distribution({"packages": ["pkg"],
                             "package_dir": {"pkg": sources}})
        # script_name need not exist, it just need to be initialized
        dist.script_name = os.path.join(sources, "setup.py")
        dist.command_obj["build"] = support.DummyCommand(
            force=0,
            build_lib=destination)
        dist.packages = ["pkg"]
        dist.package_data = {"pkg": ["README.txt"]}
        dist.package_dir = {"pkg": sources}

        cmd = build_py(dist)
        cmd.compile = 1
        cmd.ensure_finalized()
        self.assertEqual(cmd.package_data, dist.package_data)

        cmd.run()

        # This makes sure the list of outputs includes byte-compiled
        # files for Python modules but not for package data files
        # (there shouldn't *be* byte-code files for those!).
        #
        self.assertEqual(len(cmd.get_outputs()), 3)
        pkgdest = os.path.join(destination, "pkg")
        files = os.listdir(pkgdest)
        return files 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:43,代码来源:test_build_py.py


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