mirror of
https://github.com/hassio-addons/docker-context-streamer.git
synced 2025-05-07 04:11:24 +00:00
🐛 Fix Python 3 compatibility
This commit is contained in:
parent
43c87597c4
commit
5ae223e8e8
1 changed files with 3 additions and 3 deletions
|
@ -30,7 +30,7 @@ output a tar stream containing both.
|
|||
"""
|
||||
|
||||
from fnmatch import fnmatchcase
|
||||
from six import StringIO
|
||||
from six import BytesIO
|
||||
from tarfile import TarFile, TarInfo
|
||||
import sys
|
||||
|
||||
|
@ -65,7 +65,7 @@ class Streamer(object):
|
|||
|
||||
def stream_context(self):
|
||||
"""Start streaming the tar context for Docker."""
|
||||
with TarFile.open(mode='w|', fileobj=sys.stdout) as tarfile:
|
||||
with TarFile.open(mode='w|', fileobj=sys.stdout.buffer) as tarfile:
|
||||
|
||||
tarfile.add(
|
||||
self.context,
|
||||
|
@ -75,4 +75,4 @@ class Streamer(object):
|
|||
|
||||
tarinfo = TarInfo('./Dockerfile')
|
||||
tarinfo.size = len(self.dockerfile)
|
||||
tarfile.addfile(tarinfo, StringIO(self.dockerfile))
|
||||
tarfile.addfile(tarinfo, BytesIO(self.dockerfile.encode('UTF-8')))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue