Skip to content

Commit

Permalink
Allow binary files to be copied into the build context
Browse files Browse the repository at this point in the history
  • Loading branch information
agyoungs committed Nov 13, 2023
1 parent d50f1c3 commit d20a9de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ def write_files(extensions, args_dict, target_directory):
'and cannot be written out, skipping' % (file_path, active_extension.get_name()))
continue
Path(os.path.dirname(full_path)).mkdir(exist_ok=True, parents=True)
with open(full_path, 'w') as fh:
mode = 'wb' if isinstance(contents, bytes) else 'w' # check to see if contents should be written as binary
with open(full_path, mode) as fh:
print('Writing to file %s' % full_path)
fh.write(contents)
return all_files
Expand Down

0 comments on commit d20a9de

Please sign in to comment.