예제 #1
0
파일: __init__.py 프로젝트: gbluma/felix
    def compile(self, src:fbuild.db.SRC, dst=None, *,
            flags=[],
            **kwargs) -> fbuild.db.DST:
        """Compile a c file and cache the results."""
        # Generate the dependencies while we compile the file.
        with tempfile() as dep:
            obj = self.uncached_compile(src, dst,
                flags=list(chain(('-MMD', '-MF', dep), flags)),
                **kwargs)

            with open(dep, 'rb') as f:
                # Parse the output and return the module dependencies.
                stdout = f.read().replace(b'\\\n', b'')

        # Parse the output and return the module dependencies.
        m = re.match(b'\s*\S+:(?: (.*))?$', stdout)
        if not m:
            raise fbuild.ExecutionError('unable to understand %r' % stdout)

        s = m.group(1)
        if s is not None:
            deps = s.decode().split()
            self.ctx.db.add_external_dependencies_to_call(srcs=deps)

        return obj
예제 #2
0
    def compile(self,
                src: fbuild.db.SRC,
                dst=None,
                *,
                flags=[],
                **kwargs) -> fbuild.db.DST:
        """Compile a c file and cache the results."""
        # Generate the dependencies while we compile the file.
        with tempfile() as dep:
            obj = self.uncached_compile(src,
                                        dst,
                                        flags=list(
                                            chain(('-MMD', '-MF', dep),
                                                  flags)),
                                        **kwargs)

            with open(dep, 'rb') as f:
                # Parse the output and return the module dependencies.
                stdout = f.read().replace(b'\\\n', b'')

        # Parse the output and return the module dependencies.
        m = re.match(b'\s*\S+:(?: (.*))?$', stdout)
        if not m:
            raise fbuild.ExecutionError('unable to understand %r' % stdout)

        s = m.group(1)
        if s is not None:
            deps = s.decode().split()
            self.ctx.db.add_external_dependencies_to_call(srcs=deps)

        return obj
예제 #3
0
    def check_flags(self, flags):
        if flags:
            self.ctx.logger.check('checking %s with %s' %
                                  (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        code = 'int main(int argc, char** argv){return 0;}'

        with tempfile(code, suffix=self.src_suffix) as src:
            try:
                self([src], flags=flags, quieter=1, cwd=src.parent)
            except fbuild.ExecutionError:
                self.ctx.logger.failed()
                return False

        self.ctx.logger.passed()
        return True
예제 #4
0
파일: __init__.py 프로젝트: gbluma/felix
    def check_flags(self, flags):
        if flags:
            self.ctx.logger.check('checking %s with %s' %
                (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        code = 'int main(int argc, char** argv){return 0;}'

        with tempfile(code, suffix='.c') as src:
            try:
                self([src], flags=flags, quieter=1, cwd=src.parent)
            except fbuild.ExecutionError:
                self.ctx.logger.failed()
                return False

        self.ctx.logger.passed()
        return True
예제 #5
0
파일: felix.py 프로젝트: eccstartup/felix
    def check_flags(self, flags=[]):
        if flags:
            self.ctx.logger.check("checking %s with %s" % (self, " ".join(flags)))
        else:
            self.ctx.logger.check("checking %s" % self)

        with tempfile("", suffix=".flx") as src:
            try:
                self(src, flags=flags, quieter=1)
            except fbuild.ExecutionError as e:
                self.ctx.logger.failed()
                if e.stdout:
                    self.ctx.logger.log(e.stdout.decode())
                if e.stderr:
                    self.ctx.logger.log(e.stderr.decode())
                return False

        self.ctx.logger.passed()
        return True
예제 #6
0
파일: felix.py 프로젝트: rjeschmi/fbuild
    def check_flags(self, flags=[]):
        if flags:
            self.ctx.logger.check('checking %s with %s' %
                                  (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        with tempfile('', suffix='.flx') as src:
            try:
                self(src, flags=flags, quieter=1)
            except fbuild.ExecutionError as e:
                self.ctx.logger.failed()
                if e.stdout:
                    self.ctx.logger.log(e.stdout.decode())
                if e.stderr:
                    self.ctx.logger.log(e.stderr.decode())
                return False

        self.ctx.logger.passed()
        return True
예제 #7
0
파일: felix.py 프로젝트: alexkross/felix
    def check_flags(self, flags=[]):
        if flags:
            self.ctx.logger.check('checking %s with %s' %
                (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        with tempfile('', suffix='.flx') as src:
            try:
                self(src, flags=flags, quieter=1, timeout=120)
            except fbuild.ExecutionError as e:
                self.ctx.logger.failed()
                if e.stdout:
                    self.ctx.logger.log(e.stdout.decode())
                if e.stderr:
                    self.ctx.logger.log(e.stderr.decode())
                return False

        self.ctx.logger.passed()
        return True
예제 #8
0
    def check_flags(self, flags=[]):
        """Verify that we can run with these flags."""

        if flags:
            self.ctx.logger.check('checking %s with %s' %
                                  (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        with tempfile('', suffix=self.src_suffix) as src:
            try:
                self._run([src], flags=flags, quieter=1)
            except fbuild.ExecutionError as e:
                self.ctx.logger.failed()
                if e.stdout:
                    self.ctx.logger.log(e.stdout.decode())
                if e.stderr:
                    self.ctx.logger.log(e.stderr.decode())
                return False

        self.ctx.logger.passed()
        return True
예제 #9
0
파일: java.py 프로젝트: DawidvC/felix
    def check_flags(self, flags=[]):
        """Verify that we can run with these flags."""

        if flags:
            self.ctx.logger.check('checking %s with %s' %
                (self, ' '.join(flags)))
        else:
            self.ctx.logger.check('checking %s' % self)

        with tempfile('', suffix=self.src_suffix) as src:
            try:
                self._run([src], flags=flags, quieter=1)
            except fbuild.ExecutionError as e:
                self.ctx.logger.failed()
                if e.stdout:
                    self.ctx.logger.log(e.stdout.decode())
                if e.stderr:
                    self.ctx.logger.log(e.stderr.decode())
                return False

        self.ctx.logger.passed()
        return True