Exemple #1
0
def register_commands(global_context):
    global_context.register_command("help", HelpCommand())
    global_context.register_command("configure", ConfigureCommand())
    global_context.register_command("build", BuildCommand())
    global_context.register_command("install", InstallCommand())
    global_context.register_command("convert", ConvertCommand())
    global_context.register_command("sdist", SdistCommand())
    global_context.register_command("build_egg", BuildEggCommand())
    global_context.register_command("build_wininst", BuildWininstCommand())
    global_context.register_command("sphinx", SphinxCommand())
    global_context.register_command("register_pypi", RegisterPyPI())
    global_context.register_command("upload_pypi", UploadPyPI())

    global_context.register_command("build_pkg_info",
                                    BuildPkgInfoCommand(),
                                    public=False)
    global_context.register_command("parse", ParseCommand(), public=False)
    global_context.register_command("detect_type",
                                    DetectTypeCommand(),
                                    public=False)

    if sys.platform == "darwin":
        import bento.commands.build_mpkg
        global_context.register_command(
            "build_mpkg",
            bento.commands.build_mpkg.BuildMpkgCommand(),
            public=False)
        global_context.set_before("build_mpkg", "build")

    if sys.platform == "win32":
        from bento.commands.build_msi \
            import \
                BuildMsiCommand
        global_context.register_command("build_msi", BuildMsiCommand())
        global_context.set_before("build_msi", "build")
Exemple #2
0
    def test_compiled_library(self):
        from bento.backends.distutils_backend import DistutilsBuildContext

        r_full_name = "lib/_foo"

        bento_info = """\
Name: foo

Library:
    CompiledLibrary: lib/_foo
        Sources: foo.c
"""
        package = PackageDescription.from_string(bento_info)
        create_fake_package_from_bento_info(self.top_node, bento_info)

        options = OptionsContext.from_command(BuildCommand())
        context = DistutilsBuildContext(None, [], options, package,
                                        self.run_node)
        context.pre_recurse(self.top_node)
        try:

            def builder(a):
                self.assertEqual(a.name, r_full_name)
                builder.is_called = True

            builder.is_called = False
            context.register_compiled_library_builder("lib/_foo", builder)
        finally:
            context.post_recurse()
        context.compile()

        self.assertTrue(builder.is_called, "registered builder not called")
Exemple #3
0
    def test_simple_distutils(self):
        top_node = self.top_node

        create_fake_package_from_bento_info(top_node, BENTO_INFO_WITH_EXT)
        conf, configure = prepare_configure(top_node, BENTO_INFO_WITH_EXT, DistutilsConfigureContext)
        run_command_in_context(conf, configure)

        build = BuildCommand()
        opts = OptionsContext.from_command(build)

        bld = DistutilsBuildContext(None, [], opts, conf.pkg, top_node)
        run_command_in_context(bld, build)
Exemple #4
0
def create_global_context(package, package_options, backend=None):
    if backend is None:
        backend = YakuBackend()

    global_context = GlobalContext(None)
    global_context.register_package_options(package_options)
    if backend:
        global_context.backend = backend

    build = BuildCommand()
    configure = ConfigureCommand()

    commands = (("configure", configure), ("build", build))

    for cmd_name, cmd in commands:
        global_context.register_command(cmd_name, cmd)
        options_context = OptionsContext.from_command(cmd)
        global_context.register_options_context(cmd_name, options_context)

    global_context.backend.register_command_contexts(global_context)
    global_context.backend.register_options_contexts(global_context)

    return global_context
def register_commands(global_context):
    global_context.register_command("configure", ConfigureCommand())
    global_context.register_command("build", BuildCommand())
    global_context.register_command("install", InstallCommand())
    global_context.register_command("sdist", SdistCommand())
    global_context.register_command("build_egg", BuildEggCommand())