def test_get_tc_gcc_compiler(self): """ Get gcc compiler from the toolchain path. """ compilation_action = \ "clang --gcc-toolchain=/home/user/my_gcc/toolchain" toolchain = \ gcc_toolchain.toolchain_in_args(shlex.split(compilation_action)) print(toolchain) self.assertEqual(toolchain, "/home/user/my_gcc/toolchain") tc_compiler_c = gcc_toolchain.get_toolchain_compiler(toolchain, "c") print(tc_compiler_c) self.assertEqual(tc_compiler_c, "/home/user/my_gcc/toolchain/bin/gcc")
def get_dependent_headers(buildaction, archive): LOG.debug("Generating dependent headers via compiler...") command = shlex.split(buildaction.original_command) try: dependencies = set(create_dependencies(command, buildaction.directory)) except Exception as ex: LOG.debug("Couldn't create dependencies:") LOG.debug(str(ex)) # TODO append with buildaction archive.writestr("no-sources", str(ex)) dependencies = set() toolchain = gcc_toolchain.toolchain_in_args( shlex.split(buildaction.original_command)) if toolchain: LOG.debug("Generating gcc-toolchain headers via toolchain compiler...") try: # Change the original compiler to the compiler from the # toolchain. toolchain_compiler = gcc_toolchain.get_toolchain_compiler( toolchain, buildaction.lang) if not toolchain_compiler: raise Exception("Could not get the compiler " "from the gcc-toolchain.") command[0] = toolchain_compiler dependencies = dependencies.union( set(create_dependencies(command, buildaction.directory))) except Exception as ex: LOG.debug("Couldn't create dependencies:") LOG.debug(str(ex)) # TODO append with buildaction archive.writestr("no-sources", str(ex)) dependencies = set() return dependencies