compiler.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:pygrunt 作者: elementbound 项目源码 文件源码
def compile_object(self, in_file, out_file):
        import subprocess

        in_file = Path(in_file)
        out_file = Path(out_file)

        # Skip compile if RecompileStrategy says so
        # Since preprocess_source ( possibly used by recompile ) also modifies self._args,
        # we gotta back it up
        # TODO: Maybe use something more elegant than self._args?
        old_args = self._args
        if out_file.is_file():
            if not self.recompile.should_recompile(str(in_file)):
                # Style.info('Nothing to do with', in_file)
                return True
        self._args = old_args

        Path(out_file).parent.mkdir(parents=True, exist_ok=True)
        self._args.extend(self._build_compiler_flags())
        result = subprocess.run(self._args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)

        # TODO: do something useful with output
        if result.stdout:
            print(result.stdout)

        if result.stderr:
            print(result.stderr)

        return result.returncode == 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号