Package obitools :: Module zipfile
[hide private]
[frames] | no frames]

Module zipfile

source code

Read and write ZIP files.

Classes [hide private]
  BadZipfile
  LargeZipFile
Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled.
  error
  ZipInfo
Class with attributes describing each file in the ZIP archive.
  _ZipDecrypter
Class to handle decryption of files stored within a ZIP archive.
  ZipExtFile
File-like object for reading an archive member.
  ZipFile
Class with methods to open, read, write, close, list zip files.
  PyZipFile
Class to create ZIP archives with Python library files and packages.
Functions [hide private]
 
is_zipfile(filename)
Quickly see if file is a ZIP file by checking the magic number.
source code
 
_EndRecData64(fpin, offset, endrec)
Read the ZIP64 end-of-archive records and use that to update endrec
source code
 
_EndRecData(fpin)
Return data from the "End of Central Directory" record, or None.
source code
 
main(args=None) source code
Variables [hide private]
  ZIP64_LIMIT = 2147483647
  ZIP_STORED = 0
  ZIP_DEFLATED = 8
  structEndArchive = '<4s4H2LH'
  stringEndArchive = 'PK\x05\x06'
  structCentralDir = '<4s4B4HLLL5HLL'
  stringCentralDir = 'PK\x01\x02'
  structFileHeader = '<4s2B4HLLL2H'
  stringFileHeader = 'PK\x03\x04'
  structEndArchive64Locator = '<4sLQL'
  stringEndArchive64Locator = 'PK\x06\x07'
  structEndArchive64 = '<4sQHHLLQQQQ'
  stringEndArchive64 = 'PK\x06\x06'
  _CD_SIGNATURE = 0
  _CD_CREATE_VERSION = 1
  _CD_CREATE_SYSTEM = 2
  _CD_EXTRACT_VERSION = 3
  _CD_EXTRACT_SYSTEM = 4
  _CD_FLAG_BITS = 5
  _CD_COMPRESS_TYPE = 6
  _CD_TIME = 7
  _CD_DATE = 8
  _CD_CRC = 9
  _CD_COMPRESSED_SIZE = 10
  _CD_UNCOMPRESSED_SIZE = 11
  _CD_FILENAME_LENGTH = 12
  _CD_EXTRA_FIELD_LENGTH = 13
  _CD_COMMENT_LENGTH = 14
  _CD_DISK_NUMBER_START = 15
  _CD_INTERNAL_FILE_ATTRIBUTES = 16
  _CD_EXTERNAL_FILE_ATTRIBUTES = 17
  _CD_LOCAL_HEADER_OFFSET = 18
  _FH_SIGNATURE = 0
  _FH_EXTRACT_VERSION = 1
  _FH_EXTRACT_SYSTEM = 2
  _FH_GENERAL_PURPOSE_FLAG_BITS = 3
  _FH_COMPRESSION_METHOD = 4
  _FH_LAST_MOD_TIME = 5
  _FH_LAST_MOD_DATE = 6
  _FH_CRC = 7
  _FH_COMPRESSED_SIZE = 8
  _FH_UNCOMPRESSED_SIZE = 9
  _FH_FILENAME_LENGTH = 10
  _FH_EXTRA_FIELD_LENGTH = 11
  __package__ = 'obitools'

Imports: struct, os, time, sys, shutil, binascii, cStringIO, zlib, crc32


Function Details [hide private]

_EndRecData(fpin)

source code 

Return data from the "End of Central Directory" record, or None.

The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.