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) configure.run(conf) conf.shutdown() build = BuildCommand() opts = OptionsContext.from_command(build) bld = DistutilsBuildContext([], opts, conf.pkg, top_node) build.run(bld)
def test_simple(self): root = self.root top_node = root.find_node(self.d) create_fake_package_from_bento_info(top_node, BENTO_INFO) conf, configure = prepare_configure(top_node, BENTO_INFO, ConfigureYakuContext) configure.run(conf) conf.shutdown() build = BuildCommand() opts = OptionsContext.from_command(build) bld = BuildYakuContext([], opts, conf.pkg, top_node) build.run(bld)
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")
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")
def test_simple_waf(self): from bento.commands.extras.waf import ConfigureWafContext, BuildWafContext, make_stream_logger, register_options 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, ConfigureWafContext) configure.run(conf) conf.shutdown() build = BuildCommand() # opts = OptionsContext.from_command(build) opts = prepare_options("build", build, BuildWafContext) bld = BuildWafContext(None, [], opts, conf.pkg, top_node) bld.waf_context.logger = make_stream_logger("build", cStringIO()) build.run(bld)
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)
def test_simple(self): root = self.root top_node = self.top_node run_node = self.run_node bento_info = """\ Name: foo Recurse: bar """ bento_info2 = """\ Recurse: foo Library: Modules: fubar Extension: _foo Sources: foo.c """ bento_info3 = """\ Library: Modules: foufoufou Packages: sub2 """ bentos = {"bento.info": bento_info, os.path.join("bar", "bento.info"): bento_info2, os.path.join("bar", "foo", "bento.info"): bento_info3} create_fake_package_from_bento_infos(run_node, bentos) conf, configure = prepare_configure(run_node, bento_info, ConfigureYakuContext) configure.run(conf) conf.shutdown() build = BuildCommand() opts = OptionsContext.from_command(build) cmd_argv = [] bld = BuildYakuContext(cmd_argv, opts, conf.pkg, run_node) build.run(bld)
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())