• Home
  • Raw
  • Download

Lines Matching refs:zinfo

890         for zinfo in self.filelist:
891 date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
892 print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size)
897 for zinfo in self.filelist:
901 with self.open(zinfo.filename, "r") as f:
905 return zinfo.filename
961 zinfo = name
964 zinfo = self.getinfo(name)
966 zef_file.seek(zinfo.header_offset, 0)
980 if fname != zinfo.orig_filename:
983 zinfo.orig_filename, fname)
986 is_encrypted = zinfo.flag_bits & 0x1
1003 if zinfo.flag_bits & 0x8:
1005 check_byte = (zinfo._raw_time >> 8) & 0xff
1008 check_byte = (zinfo.CRC >> 24) & 0xff
1012 return ZipExtFile(zef_file, mode, zinfo, zd,
1091 def _writecheck(self, zinfo): argument
1093 if zinfo.filename in self.NameToInfo:
1095 warnings.warn('Duplicate name: %r' % zinfo.filename, stacklevel=3)
1101 if zinfo.compress_type == ZIP_DEFLATED and not zlib:
1104 if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
1111 elif zinfo.file_size > ZIP64_LIMIT:
1113 elif zinfo.header_offset > ZIP64_LIMIT:
1138 zinfo = ZipInfo(arcname, date_time)
1139 zinfo.external_attr = (st[0] & 0xFFFF) << 16L # Unix attributes
1141 zinfo.compress_type = ZIP_STORED
1143 zinfo.compress_type = self.compression
1145 zinfo.compress_type = compress_type
1147 zinfo.file_size = st.st_size
1148 zinfo.flag_bits = 0x00
1149 zinfo.header_offset = self.fp.tell() # Start of header bytes
1151 self._writecheck(zinfo)
1155 zinfo.file_size = 0
1156 zinfo.compress_size = 0
1157 zinfo.CRC = 0
1158 zinfo.external_attr |= 0x10 # MS-DOS directory flag
1159 self.filelist.append(zinfo)
1160 self.NameToInfo[zinfo.filename] = zinfo
1161 self.fp.write(zinfo.FileHeader(False))
1166 zinfo.CRC = CRC = 0
1167 zinfo.compress_size = compress_size = 0
1170 zinfo.file_size * 1.05 > ZIP64_LIMIT
1171 self.fp.write(zinfo.FileHeader(zip64))
1172 if zinfo.compress_type == ZIP_DEFLATED:
1192 zinfo.compress_size = compress_size
1194 zinfo.compress_size = file_size
1195 zinfo.CRC = CRC
1196 zinfo.file_size = file_size
1205 self.fp.seek(zinfo.header_offset, 0)
1206 self.fp.write(zinfo.FileHeader(zip64))
1208 self.filelist.append(zinfo)
1209 self.NameToInfo[zinfo.filename] = zinfo
1216 zinfo = ZipInfo(filename=zinfo_or_arcname,
1219 zinfo.compress_type = self.compression
1220 if zinfo.filename[-1] == '/':
1221 zinfo.external_attr = 0o40775 << 16 # drwxrwxr-x
1222 zinfo.external_attr |= 0x10 # MS-DOS directory flag
1224 zinfo.external_attr = 0o600 << 16 # ?rw-------
1226 zinfo = zinfo_or_arcname
1233 zinfo.compress_type = compress_type
1235 zinfo.file_size = len(bytes) # Uncompressed size
1236 zinfo.header_offset = self.fp.tell() # Start of header bytes
1237 self._writecheck(zinfo)
1239 zinfo.CRC = crc32(bytes) & 0xffffffff # CRC-32 checksum
1240 if zinfo.compress_type == ZIP_DEFLATED:
1244 zinfo.compress_size = len(bytes) # Compressed size
1246 zinfo.compress_size = zinfo.file_size
1247 zip64 = zinfo.file_size > ZIP64_LIMIT or \
1248 zinfo.compress_size > ZIP64_LIMIT
1251 self.fp.write(zinfo.FileHeader(zip64))
1253 if zinfo.flag_bits & 0x08:
1256 self.fp.write(struct.pack(fmt, zinfo.CRC, zinfo.compress_size,
1257 zinfo.file_size))
1259 self.filelist.append(zinfo)
1260 self.NameToInfo[zinfo.filename] = zinfo
1275 for zinfo in self.filelist: # write central directory
1276 dt = zinfo.date_time
1280 if zinfo.file_size > ZIP64_LIMIT \
1281 or zinfo.compress_size > ZIP64_LIMIT:
1282 extra.append(zinfo.file_size)
1283 extra.append(zinfo.compress_size)
1287 file_size = zinfo.file_size
1288 compress_size = zinfo.compress_size
1290 header_offset = zinfo.header_offset - self._start_disk
1295 extra_data = zinfo.extra
1302 extract_version = max(45, zinfo.extract_version)
1303 create_version = max(45, zinfo.create_version)
1305 extract_version = zinfo.extract_version
1306 create_version = zinfo.create_version
1309 filename, flag_bits = zinfo._encodeFilenameFlags()
1312 zinfo.create_system, extract_version, zinfo.reserved,
1313 flag_bits, zinfo.compress_type, dostime, dosdate,
1314 zinfo.CRC, compress_size, file_size,
1315 len(filename), len(extra_data), len(zinfo.comment),
1316 0, zinfo.internal_attr, zinfo.external_attr,
1321 zinfo.create_system, extract_version, zinfo.reserved,
1322 zinfo.flag_bits, zinfo.compress_type, dostime, dosdate,
1323 zinfo.CRC, compress_size, file_size,
1324 len(zinfo.filename), len(extra_data), len(zinfo.comment),
1325 0, zinfo.internal_attr, zinfo.external_attr,
1331 self.fp.write(zinfo.comment)