コード例 #1
0
ファイル: mksfx.py プロジェクト: nxt3-org/nxt3
 def file_filter(info: tarfile.TarInfo):
     info.mode = 0o00777 if executable else 0o00666
     info.mtime = 0
     info.type = tarfile.REGTYPE
     info.uid = info.gid = 0
     info.uname = info.gname = "root"
     info.pax_headers = {}
     return info
コード例 #2
0
ファイル: script_mode.py プロジェクト: flyteorg/flytekit
def tar_strip_file_attributes(tar_info: tarfile.TarInfo) -> tarfile.TarInfo:
    # set time to epoch timestamp 0, aka 00:00:00 UTC on 1 January 1970
    # note that when extracting this tarfile, this time will be shown as the modified date
    tar_info.mtime = 0

    # user/group info
    tar_info.uid = 0
    tar_info.uname = ""
    tar_info.gid = 0
    tar_info.gname = ""

    # stripping paxheaders may not be required
    # see https://stackoverflow.com/questions/34688392/paxheaders-in-tarball
    tar_info.pax_headers = {}

    return tar_info