Add an option to gzip tar files.

This can be used to make building much faster.

Signed-off-by: speedplane <mes65@cornell.edu>
This commit is contained in:
Michael Sander 2016-02-09 05:06:08 -05:00 committed by Joffrey F
parent 4c34be5d4a
commit 4529dceaaf
1 changed files with 2 additions and 2 deletions

View File

@ -91,10 +91,10 @@ def decode_json_header(header):
return json.loads(data)
def tar(path, exclude=None, dockerfile=None, fileobj=None):
def tar(path, exclude=None, dockerfile=None, fileobj=None, gzip=False):
if not fileobj:
fileobj = tempfile.NamedTemporaryFile()
t = tarfile.open(mode='w', fileobj=fileobj)
t = tarfile.open(mode='w:gz' if gzip else 'w', fileobj=fileobj)
root = os.path.abspath(path)
exclude = exclude or []