Skip to content

Commit

Permalink
[one-cmds] add command option to one-codegen (Samsung#5342)
Browse files Browse the repository at this point in the history
This commit has two changes.
- Don't make a log file
- Add command option

ONE-DCO-1.0-ONE-DCO-1.0-Signed-off-by: seongwoo <[email protected]>
  • Loading branch information
mhs4670go authored Dec 10, 2020
1 parent 3fb808c commit 7e36858
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions compiler/one-cmds/one-codegen
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,19 @@ def main():
# verify arguments
_verify_arg(parser, args)

# get file path to log
# make a command to run given backend driver
dir_path = os.path.dirname(os.path.realpath(__file__))
logfile_path = os.path.realpath(args.output_path) + '.log'

with open(logfile_path, 'wb') as f:
# make a command to run given backend driver
codegen_path = os.path.join(dir_path, getattr(args, 'backend') + '-compile')
codegen_cmd = [codegen_path] + unknown_args

f.write((' '.join(codegen_cmd) + '\n').encode())

# run backend driver
with subprocess.Popen(
codegen_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
bufsize=1) as p:
for line in p.stdout:
sys.stdout.buffer.write(line)
f.write(line)
codegen_path = os.path.join(dir_path, getattr(args, 'backend') + '-compile')
codegen_cmd = [codegen_path] + unknown_args
if _utils._is_valid_attr(args, 'command'):
codegen_cmd += getattr(args, 'command').split()

# run backend driver
with subprocess.Popen(
codegen_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
bufsize=1) as p:
for line in p.stdout:
sys.stdout.buffer.write(line)


if __name__ == '__main__':
Expand Down

0 comments on commit 7e36858

Please sign in to comment.