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
评论列表
文章目录