コード例 #1
0
    def compile(self, cc, source, object, includes):
        # Check dependencies
        base, _ = splitext(object)
        dep_path = base + '.d'
        if (not exists(dep_path) or self.need_update(
                object, self.parse_dependencies(dep_path))):
            self.progress("compile", source)

            # Compile
            command = cc + ['-D%s' % s for s in self.symbols
                            ] + ["-I%s" % i
                                 for i in includes] + ["-o", object, source]
            if hasattr(self, "get_dep_opt"):
                command.extend(self.get_dep_opt(dep_path))

            if hasattr(self, "cc_extra"):
                command.extend(self.cc_extra(base))

            self.debug(command)
            _, stderr, rc = run_cmd(command,
                                    dirname(object),
                                    chroot=self.CHROOT)

            # Parse output for Warnings and Errors
            self.parse_output(stderr)

            # Check return code
            if rc != 0:
                raise ToolException(stderr)
コード例 #2
0
    def compile_queue(self, queue, objects):
        jobs_count = int(self.jobs if self.jobs else cpu_count())
        p = Pool(processes=jobs_count)

        results = []
        for i in range(len(queue)):
            results.append(p.apply_async(compile_worker, [queue[i]]))

        itr = 0
        while True:
            itr += 1
            if itr > 30000:
                p.terminate()
                p.join()
                raise ToolException("Compile did not finish in 5 minutes")

            pending = 0
            for r in results:
                if r._ready is True:
                    try:
                        result = r.get()
                        results.remove(r)

                        self.compiled += 1
                        self.progress("compile", result['source'], build_update=True)
                        for res in result['results']:
                            self.debug("Command: %s" % ' '.join(res['command']))
                            self.compile_output([
                                res['code'],
                                res['output'],
                                res['command']
                            ])
                        objects.append(result['object'])
                    except ToolException, err:
                        p.terminate()
                        p.join()
                        raise ToolException(err)
                else:
                    pending += 1
                    if pending > jobs_count:
                        break


            if len(results) == 0:
                break

            sleep(0.01)
コード例 #3
0
 def default_cmd(self, command):
     self.debug(command)
     stdout, stderr, rc = run_cmd(command, chroot=self.CHROOT)
     self.debug(stdout)
     if rc != 0:
         for line in stderr.splitlines():
             self.tool_error(line)
         raise ToolException(stderr)
コード例 #4
0
ファイル: __init__.py プロジェクト: yzdel7/mbed
    def default_cmd(self, command):
        self.debug("Command: %s" % ' '.join(command))
        stdout, stderr, rc = run_cmd(command)
        self.debug("Return: %s" % rc)
        self.debug("Output: %s" % ' '.join(stdout))

        if rc != 0:
            for line in stderr.splitlines():
                self.tool_error(line)
            raise ToolException(stderr)
コード例 #5
0
ファイル: __init__.py プロジェクト: yzdel7/mbed
    def compile_output(self, output=[]):
        rc = output[0]
        stderr = output[1]
        command = output[2]

        # Parse output for Warnings and Errors
        self.parse_output(stderr)
        self.debug("Return: %s" % rc)
        self.debug("Output: %s" % stderr)

        # Check return code
        if rc != 0:
            raise ToolException(stderr)
コード例 #6
0
ファイル: __init__.py プロジェクト: ttajmaje/mbed
    def compile_output(self, output=[]):
        _rc = output[0]
        _stderr = output[1]
        command = output[2]

        # Parse output for Warnings and Errors
        self.parse_output(_stderr)
        self.debug("Return: %s" % _rc)
        for error_line in _stderr.splitlines():
            self.debug("Output: %s" % error_line)

        # Check return code
        if _rc != 0:
            for line in _stderr.splitlines():
                self.tool_error(line)
            raise ToolException(_stderr)
コード例 #7
0
ファイル: __init__.py プロジェクト: Parthasarathy/mbed
    def default_cmd(self, command):
        _stdout, _stderr, _rc = run_cmd(command)
        # Print all warning / erros from stderr to console output
        for error_line in _stderr.splitlines():
            print error_line

        self.debug("Command: %s" % ' '.join(command))
        self.debug("Return: %s" % _rc)

        for output_line in _stdout.splitlines():
            self.debug("Output: %s" % output_line)
        for error_line in _stderr.splitlines():
            self.debug("Errors: %s" % error_line)

        if _rc != 0:
            for line in _stderr.splitlines():
                self.tool_error(line)
            raise ToolException(_stderr)