def _require_c_compiler_distutils(): from bento.commands.build_distutils import DistutilsBuilder builder = DistutilsBuilder() try: if len(builder.ext_bld_cmd.compiler.executables) < 1: return unittest.skipIf(True, "No C compiler available") return unittest.skipIf(False, "") except Exception: return unittest.skipIf(True, "No C compiler available")
def _require_c_compiler_yaku(): import yaku.context source_path = tempfile.mkdtemp() build_path = os.path.join(source_path, "build") context = yaku.context.get_cfg(src_path=source_path, build_path=build_path) try: context.use_tools(["pyext", "ctasks"]) return unittest.skipIf(False, "") except ValueError: return unittest.skipIf(True, "No C compiler available")
def skip_if(condition, msg=""): return unittest.skipIf(condition, msg)