I would appreciate python code for creating *.cab files.
>
--V. Stokes
Here is some code that I have still laying around. It has never been
used in production and I do not know what you can do with the cab files
it creates, but I have been able to create a cab and open it with winzip.
Thomas
<cab.py>
from ctypes import *
import sys, os, tempfile, glob
class ERF(Structure):
_fields_ = [("erfOper", c_int),
("erfType", c_int),
("fError", BOOL)]
CB_MAX_CHUNK = 32768
CB_MAX_DISK = 0x7ffffff
CB_MAX_FILENAME = 256
CB_MAX_CABINET_ NAME = 256
CB_MAX_CAB_PATH = 256
CB_MAX_DISK_NAM E = 256
class CCAB(Structure) :
_fields_ = [
("cb", ULONG), # size available for cabinet on this media
("cbFolderThres h", ULONG), # Thresshold for forcing a new Folder
("cbReserveCFHe ader", UINT), # Space to reserve in CFHEADER
("cbReserveCFFo lder", UINT), # Space to reserve in CFFOLDER
("cbReserveCFDa ta", UINT), # Space to reserve in CFDATA
("iCab", c_int), # sequential numbers for cabinets
("iDisk", c_int), # Disk number
("fFailOnIncomp ressible", c_int), # TRUE =Fail if a block is incompressible
("setID", USHORT), # Cabinet set ID
("szDisk", c_char * CB_MAX_DISK_NAM E), # current disk name
("szCab", c_char * CB_MAX_CABINET_ NAME), # current cabinet name
("szCabPath" , c_char * CB_MAX_CAB_PATH ), # path for creating cabinet
]
cab = cdll.cabinet
class HFCI(object):
_handle = 0
_as_parameter_ = property(lambda self: self._handle)
I would appreciate python code for creating *.cab files.
The msilib module of Python 2.5 can be used to create CAB files,
through msilib.FCICreat e(cabname, filelist), where filelist is
a list of (systempath, cabpath).
Comment