36.1 msilib -- Read and write Microsoft Installer files

Python 2.5

36.1 msilib -- Read and write Microsoft Installer files

Availability: Windows.

New in version 2.5.

The msilib supports the creation of Microsoft Installer (.msi) files. Because these files often contain an embedded ``cabinet'' file (.cab), it also exposes an API to create CAB files. Support for reading .cab files is currently not implemented; read support for the .msi database is possible.

This package aims to provide complete access to all tables in an .msi file, therefore, it is a fairly low-level API. Two primary applications of this package are the distutils command bdist_msi, and the creation of Python installer package itself (although that currently uses a different version of msilib).

The package contents can be roughly split into four parts: low-level CAB routines, low-level MSI routines, higher-level MSI routines, and standard table structures.

Create a new CAB file named cabname. files must be a list of tuples, each containing the name of the file on disk, and the name of the file inside the CAB file.

The files are added to the CAB file in the order they appear in the list. All files are added into a single CAB file, using the MSZIP compression algorithm.

Callbacks to Python for the various steps of MSI creation are currently not exposed.

Return the string representation of a new unique identifier. This wraps the Windows API functions UuidCreate and UuidToString.

Return a new database object by calling MsiOpenDatabase. path is the file name of the MSI file; persist can be one of the constants MSIDBOPEN_CREATEDIRECT, MSIDBOPEN_CREATE, MSIDBOPEN_DIRECT, MSIDBOPEN_READONLY, or MSIDBOPEN_TRANSACT, and may include the flag MSIDBOPEN_PATCHFILE. See the Microsoft documentation for the meaning of these flags; depending on the flags, an existing database is opened, or a new one created.

Return a new record object by calling MSICreateRecord. count is the number of fields of the record.

Create and return a new database name, initialize it with schema, and set the properties ProductName, ProductCode, ProductVersion, and Manufacturer.

schema must be a module object containing tables and _Validation_records attributes; typically, msilib.schema should be used.

The database will contain just the schema and the validation records when this function returns.

Add all records to database. records should be a list of tuples, each one containing all fields of a record according to the schema of the table. For optional fields, None can be passed.

Field values can be int or long numbers, strings, or instances of the Binary class.

Represents entries in the Binary table; inserting such an object using add_data reads the file named filename into the table.

Add all table content from module to database. module must contain an attribute tables listing all tables for which content should be added, and one attribute per table that has the actual content.

This is typically used to install the sequence tables.

Add the file path into the _Stream table of database, with the stream name name.

Return a new UUID, in the format that MSI typically requires (i.e. in curly braces, and with all hexdigits in upper-case).


See About this document... for information on suggesting changes.