Kaydet (Commit) 52c2cc84 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #1228 from christianbundy/synthesize-execute-bit

Synthesize execute permission bit
......@@ -4,6 +4,7 @@ import os
import os.path
import json
import shlex
import sys
import tarfile
import tempfile
import warnings
......@@ -92,7 +93,21 @@ def tar(path, exclude=None, dockerfile=None, fileobj=None, gzip=False):
exclude = exclude or []
for path in sorted(exclude_paths(root, exclude, dockerfile=dockerfile)):
t.add(os.path.join(root, path), arcname=path, recursive=False)
i = t.gettarinfo(os.path.join(root, path), arcname=path)
if sys.platform == 'win32':
# Windows doesn't keep track of the execute bit, so we make files
# and directories executable by default.
i.mode = i.mode & 0o755 | 0o111
try:
# We open the file object in binary mode for Windows support.
f = open(os.path.join(root, path), 'rb')
except IOError:
# When we encounter a directory the file object is set to None.
f = None
t.addfile(i, f)
t.close()
fileobj.seek(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment