Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | :mod:`msilib` --- Read and write Microsoft Installer files |
| 2 | ========================================================== |
| 3 | |
| 4 | .. module:: msilib |
| 5 | :platform: Windows |
| 6 | :synopsis: Creation of Microsoft Installer files, and CAB files. |
| 7 | .. moduleauthor:: Martin v. Löwis <martin@v.loewis.de> |
| 8 | .. sectionauthor:: Martin v. Löwis <martin@v.loewis.de> |
| 9 | |
| 10 | |
| 11 | .. index:: single: msi |
| 12 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 13 | The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) files. |
| 14 | Because these files often contain an embedded "cabinet" file (``.cab``), it also |
| 15 | exposes an API to create CAB files. Support for reading ``.cab`` files is |
| 16 | currently not implemented; read support for the ``.msi`` database is possible. |
| 17 | |
| 18 | This package aims to provide complete access to all tables in an ``.msi`` file, |
| 19 | therefore, it is a fairly low-level API. Two primary applications of this |
| 20 | package are the :mod:`distutils` command ``bdist_msi``, and the creation of |
| 21 | Python installer package itself (although that currently uses a different |
| 22 | version of ``msilib``). |
| 23 | |
| 24 | The package contents can be roughly split into four parts: low-level CAB |
| 25 | routines, low-level MSI routines, higher-level MSI routines, and standard table |
| 26 | structures. |
| 27 | |
| 28 | |
| 29 | .. function:: FCICreate(cabname, files) |
| 30 | |
| 31 | Create a new CAB file named *cabname*. *files* must be a list of tuples, each |
| 32 | containing the name of the file on disk, and the name of the file inside the CAB |
| 33 | file. |
| 34 | |
| 35 | The files are added to the CAB file in the order they appear in the list. All |
| 36 | files are added into a single CAB file, using the MSZIP compression algorithm. |
| 37 | |
| 38 | Callbacks to Python for the various steps of MSI creation are currently not |
| 39 | exposed. |
| 40 | |
| 41 | |
Christian Heimes | faf2f63 | 2008-01-06 16:59:19 +0000 | [diff] [blame] | 42 | .. function:: UuidCreate() |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 43 | |
| 44 | Return the string representation of a new unique identifier. This wraps the |
| 45 | Windows API functions :cfunc:`UuidCreate` and :cfunc:`UuidToString`. |
| 46 | |
| 47 | |
| 48 | .. function:: OpenDatabase(path, persist) |
| 49 | |
| 50 | Return a new database object by calling MsiOpenDatabase. *path* is the file |
| 51 | name of the MSI file; *persist* can be one of the constants |
| 52 | ``MSIDBOPEN_CREATEDIRECT``, ``MSIDBOPEN_CREATE``, ``MSIDBOPEN_DIRECT``, |
| 53 | ``MSIDBOPEN_READONLY``, or ``MSIDBOPEN_TRANSACT``, and may include the flag |
| 54 | ``MSIDBOPEN_PATCHFILE``. See the Microsoft documentation for the meaning of |
| 55 | these flags; depending on the flags, an existing database is opened, or a new |
| 56 | one created. |
| 57 | |
| 58 | |
| 59 | .. function:: CreateRecord(count) |
| 60 | |
| 61 | Return a new record object by calling :cfunc:`MSICreateRecord`. *count* is the |
| 62 | number of fields of the record. |
| 63 | |
| 64 | |
| 65 | .. function:: init_database(name, schema, ProductName, ProductCode, ProductVersion, Manufacturer) |
| 66 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 67 | Create and return a new database *name*, initialize it with *schema*, and set |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 68 | the properties *ProductName*, *ProductCode*, *ProductVersion*, and |
| 69 | *Manufacturer*. |
| 70 | |
| 71 | *schema* must be a module object containing ``tables`` and |
| 72 | ``_Validation_records`` attributes; typically, :mod:`msilib.schema` should be |
| 73 | used. |
| 74 | |
| 75 | The database will contain just the schema and the validation records when this |
| 76 | function returns. |
| 77 | |
| 78 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 79 | .. function:: add_data(database, table, records) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 80 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 81 | Add all *records* to the table named *table* in *database*. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 82 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 83 | The *table* argument must be one of the predefined tables in the MSI schema, |
| 84 | e.g. ``'Feature'``, ``'File'``, ``'Component'``, ``'Dialog'``, ``'Control'``, |
| 85 | etc. |
| 86 | |
| 87 | *records* should be a list of tuples, each one containing all fields of a |
| 88 | record according to the schema of the table. For optional fields, |
| 89 | ``None`` can be passed. |
| 90 | |
| 91 | Field values can be int or long numbers, strings, or instances of the Binary |
| 92 | class. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 93 | |
| 94 | |
| 95 | .. class:: Binary(filename) |
| 96 | |
| 97 | Represents entries in the Binary table; inserting such an object using |
| 98 | :func:`add_data` reads the file named *filename* into the table. |
| 99 | |
| 100 | |
| 101 | .. function:: add_tables(database, module) |
| 102 | |
| 103 | Add all table content from *module* to *database*. *module* must contain an |
| 104 | attribute *tables* listing all tables for which content should be added, and one |
| 105 | attribute per table that has the actual content. |
| 106 | |
| 107 | This is typically used to install the sequence tables. |
| 108 | |
| 109 | |
| 110 | .. function:: add_stream(database, name, path) |
| 111 | |
| 112 | Add the file *path* into the ``_Stream`` table of *database*, with the stream |
| 113 | name *name*. |
| 114 | |
| 115 | |
| 116 | .. function:: gen_uuid() |
| 117 | |
| 118 | Return a new UUID, in the format that MSI typically requires (i.e. in curly |
| 119 | braces, and with all hexdigits in upper-case). |
| 120 | |
| 121 | |
| 122 | .. seealso:: |
| 123 | |
| 124 | `FCICreateFile <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devnotes/winprog/fcicreate.asp>`_ |
| 125 | `UuidCreate <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/uuidcreate.asp>`_ |
| 126 | `UuidToString <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/uuidtostring.asp>`_ |
| 127 | |
| 128 | .. _database-objects: |
| 129 | |
| 130 | Database Objects |
| 131 | ---------------- |
| 132 | |
| 133 | |
| 134 | .. method:: Database.OpenView(sql) |
| 135 | |
| 136 | Return a view object, by calling :cfunc:`MSIDatabaseOpenView`. *sql* is the SQL |
| 137 | statement to execute. |
| 138 | |
| 139 | |
| 140 | .. method:: Database.Commit() |
| 141 | |
| 142 | Commit the changes pending in the current transaction, by calling |
| 143 | :cfunc:`MSIDatabaseCommit`. |
| 144 | |
| 145 | |
| 146 | .. method:: Database.GetSummaryInformation(count) |
| 147 | |
| 148 | Return a new summary information object, by calling |
| 149 | :cfunc:`MsiGetSummaryInformation`. *count* is the maximum number of updated |
| 150 | values. |
| 151 | |
| 152 | |
| 153 | .. seealso:: |
| 154 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 155 | `MSIDatabaseOpenView <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabaseopenview.asp>`_ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 156 | `MSIDatabaseCommit <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabasecommit.asp>`_ |
| 157 | `MSIGetSummaryInformation <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msigetsummaryinformation.asp>`_ |
| 158 | |
| 159 | .. _view-objects: |
| 160 | |
| 161 | View Objects |
| 162 | ------------ |
| 163 | |
| 164 | |
Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 165 | .. method:: View.Execute(params) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 166 | |
Benjamin Peterson | 4118174 | 2008-07-02 20:22:54 +0000 | [diff] [blame] | 167 | Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. If |
| 168 | *params* is not ``None``, it is a record describing actual values of the |
| 169 | parameter tokens in the query. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 170 | |
| 171 | |
| 172 | .. method:: View.GetColumnInfo(kind) |
| 173 | |
| 174 | Return a record describing the columns of the view, through calling |
| 175 | :cfunc:`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or |
| 176 | ``MSICOLINFO_TYPES``. |
| 177 | |
| 178 | |
| 179 | .. method:: View.Fetch() |
| 180 | |
| 181 | Return a result record of the query, through calling :cfunc:`MsiViewFetch`. |
| 182 | |
| 183 | |
| 184 | .. method:: View.Modify(kind, data) |
| 185 | |
| 186 | Modify the view, by calling :cfunc:`MsiViewModify`. *kind* can be one of |
| 187 | ``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, |
| 188 | ``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``, |
| 189 | ``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``, |
| 190 | ``MSIMODIFY_VALIDATE``, ``MSIMODIFY_VALIDATE_NEW``, |
| 191 | ``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``. |
| 192 | |
| 193 | *data* must be a record describing the new data. |
| 194 | |
| 195 | |
| 196 | .. method:: View.Close() |
| 197 | |
| 198 | Close the view, through :cfunc:`MsiViewClose`. |
| 199 | |
| 200 | |
| 201 | .. seealso:: |
| 202 | |
| 203 | `MsiViewExecute <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewexecute.asp>`_ |
| 204 | `MSIViewGetColumnInfo <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewgetcolumninfo.asp>`_ |
| 205 | `MsiViewFetch <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewfetch.asp>`_ |
| 206 | `MsiViewModify <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewmodify.asp>`_ |
| 207 | `MsiViewClose <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewclose.asp>`_ |
| 208 | |
| 209 | .. _summary-objects: |
| 210 | |
| 211 | Summary Information Objects |
| 212 | --------------------------- |
| 213 | |
| 214 | |
| 215 | .. method:: SummaryInformation.GetProperty(field) |
| 216 | |
| 217 | Return a property of the summary, through :cfunc:`MsiSummaryInfoGetProperty`. |
| 218 | *field* is the name of the property, and can be one of the constants |
| 219 | ``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, ``PID_AUTHOR``, |
| 220 | ``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, ``PID_LASTAUTHOR``, |
| 221 | ``PID_REVNUMBER``, ``PID_LASTPRINTED``, ``PID_CREATE_DTM``, |
| 222 | ``PID_LASTSAVE_DTM``, ``PID_PAGECOUNT``, ``PID_WORDCOUNT``, ``PID_CHARCOUNT``, |
| 223 | ``PID_APPNAME``, or ``PID_SECURITY``. |
| 224 | |
| 225 | |
| 226 | .. method:: SummaryInformation.GetPropertyCount() |
| 227 | |
| 228 | Return the number of summary properties, through |
| 229 | :cfunc:`MsiSummaryInfoGetPropertyCount`. |
| 230 | |
| 231 | |
| 232 | .. method:: SummaryInformation.SetProperty(field, value) |
| 233 | |
| 234 | Set a property through :cfunc:`MsiSummaryInfoSetProperty`. *field* can have the |
| 235 | same values as in :meth:`GetProperty`, *value* is the new value of the property. |
| 236 | Possible value types are integer and string. |
| 237 | |
| 238 | |
| 239 | .. method:: SummaryInformation.Persist() |
| 240 | |
| 241 | Write the modified properties to the summary information stream, using |
| 242 | :cfunc:`MsiSummaryInfoPersist`. |
| 243 | |
| 244 | |
| 245 | .. seealso:: |
| 246 | |
| 247 | `MsiSummaryInfoGetProperty <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfogetproperty.asp>`_ |
| 248 | `MsiSummaryInfoGetPropertyCount <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfogetpropertycount.asp>`_ |
| 249 | `MsiSummaryInfoSetProperty <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfosetproperty.asp>`_ |
| 250 | `MsiSummaryInfoPersist <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfopersist.asp>`_ |
| 251 | |
| 252 | .. _record-objects: |
| 253 | |
| 254 | Record Objects |
| 255 | -------------- |
| 256 | |
| 257 | |
| 258 | .. method:: Record.GetFieldCount() |
| 259 | |
| 260 | Return the number of fields of the record, through |
| 261 | :cfunc:`MsiRecordGetFieldCount`. |
| 262 | |
| 263 | |
Martin v. Löwis | e95593e | 2008-06-02 10:08:54 +0000 | [diff] [blame] | 264 | .. method:: Record.GetInteger(field) |
| 265 | |
| 266 | Return the value of *field* as an integer where possible. *field* must |
| 267 | be an integer. |
| 268 | |
| 269 | |
| 270 | .. method:: Record.GetString(field) |
| 271 | |
| 272 | Return the value of *field* as a string where possible. *field* must |
| 273 | be an integer. |
| 274 | |
| 275 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 276 | .. method:: Record.SetString(field, value) |
| 277 | |
| 278 | Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an |
| 279 | integer; *value* a string. |
| 280 | |
| 281 | |
| 282 | .. method:: Record.SetStream(field, value) |
| 283 | |
| 284 | Set *field* to the contents of the file named *value*, through |
| 285 | :cfunc:`MsiRecordSetStream`. *field* must be an integer; *value* a string. |
| 286 | |
| 287 | |
| 288 | .. method:: Record.SetInteger(field, value) |
| 289 | |
| 290 | Set *field* to *value* through :cfunc:`MsiRecordSetInteger`. Both *field* and |
| 291 | *value* must be an integer. |
| 292 | |
| 293 | |
| 294 | .. method:: Record.ClearData() |
| 295 | |
| 296 | Set all fields of the record to 0, through :cfunc:`MsiRecordClearData`. |
| 297 | |
| 298 | |
| 299 | .. seealso:: |
| 300 | |
| 301 | `MsiRecordGetFieldCount <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordgetfieldcount.asp>`_ |
| 302 | `MsiRecordSetString <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetstring.asp>`_ |
| 303 | `MsiRecordSetStream <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetstream.asp>`_ |
| 304 | `MsiRecordSetInteger <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetinteger.asp>`_ |
| 305 | `MsiRecordClear <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordclear.asp>`_ |
| 306 | |
| 307 | .. _msi-errors: |
| 308 | |
| 309 | Errors |
| 310 | ------ |
| 311 | |
| 312 | All wrappers around MSI functions raise :exc:`MsiError`; the string inside the |
| 313 | exception will contain more detail. |
| 314 | |
| 315 | |
| 316 | .. _cab: |
| 317 | |
| 318 | CAB Objects |
| 319 | ----------- |
| 320 | |
| 321 | |
| 322 | .. class:: CAB(name) |
| 323 | |
| 324 | The class :class:`CAB` represents a CAB file. During MSI construction, files |
| 325 | will be added simultaneously to the ``Files`` table, and to a CAB file. Then, |
| 326 | when all files have been added, the CAB file can be written, then added to the |
| 327 | MSI file. |
| 328 | |
| 329 | *name* is the name of the CAB file in the MSI file. |
| 330 | |
| 331 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 332 | .. method:: append(full, file, logical) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 333 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 334 | Add the file with the pathname *full* to the CAB file, under the name |
| 335 | *logical*. If there is already a file named *logical*, a new file name is |
| 336 | created. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 337 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 338 | Return the index of the file in the CAB file, and the new name of the file |
| 339 | inside the CAB file. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 340 | |
| 341 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 342 | .. method:: commit(database) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 343 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 344 | Generate a CAB file, add it as a stream to the MSI file, put it into the |
| 345 | ``Media`` table, and remove the generated file from the disk. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 346 | |
| 347 | |
| 348 | .. _msi-directory: |
| 349 | |
| 350 | Directory Objects |
| 351 | ----------------- |
| 352 | |
| 353 | |
| 354 | .. class:: Directory(database, cab, basedir, physical, logical, default, component, [componentflags]) |
| 355 | |
| 356 | Create a new directory in the Directory table. There is a current component at |
| 357 | each point in time for the directory, which is either explicitly created through |
| 358 | :meth:`start_component`, or implicitly when files are added for the first time. |
| 359 | Files are added into the current component, and into the cab file. To create a |
| 360 | directory, a base directory object needs to be specified (can be ``None``), the |
| 361 | path to the physical directory, and a logical directory name. *default* |
| 362 | specifies the DefaultDir slot in the directory table. *componentflags* specifies |
| 363 | the default flags that new components get. |
| 364 | |
| 365 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 366 | .. method:: start_component(component=None, feature=None, flags=None, keyfile=None, uuid=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 367 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 368 | Add an entry to the Component table, and make this component the current |
| 369 | component for this directory. If no component name is given, the directory |
| 370 | name is used. If no *feature* is given, the current feature is used. If no |
| 371 | *flags* are given, the directory's default flags are used. If no *keyfile* |
| 372 | is given, the KeyPath is left null in the Component table. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 373 | |
| 374 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 375 | .. method:: add_file(file, src=None, version=None, language=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 376 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 377 | Add a file to the current component of the directory, starting a new one |
| 378 | if there is no current component. By default, the file name in the source |
| 379 | and the file table will be identical. If the *src* file is specified, it |
| 380 | is interpreted relative to the current directory. Optionally, a *version* |
| 381 | and a *language* can be specified for the entry in the File table. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 382 | |
| 383 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 384 | .. method:: glob(pattern, exclude=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 385 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 386 | Add a list of files to the current component as specified in the glob |
| 387 | pattern. Individual files can be excluded in the *exclude* list. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 388 | |
| 389 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 390 | .. method:: remove_pyc() |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 391 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 392 | Remove ``.pyc``/``.pyo`` files on uninstall. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 393 | |
| 394 | |
| 395 | .. seealso:: |
| 396 | |
Georg Brandl | 628e6f9 | 2009-10-27 20:24:45 +0000 | [diff] [blame] | 397 | `Directory Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/directory_table.asp>`_ |
| 398 | `File Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/file_table.asp>`_ |
| 399 | `Component Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/component_table.asp>`_ |
| 400 | `FeatureComponents Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/featurecomponents_table.asp>`_ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 401 | |
| 402 | .. _features: |
| 403 | |
| 404 | Features |
| 405 | -------- |
| 406 | |
| 407 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 408 | .. class:: Feature(db, id, title, desc, display, level=1, parent=None, directory=None, attributes=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 409 | |
| 410 | Add a new record to the ``Feature`` table, using the values *id*, *parent.id*, |
| 411 | *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The |
| 412 | resulting feature object can be passed to the :meth:`start_component` method of |
| 413 | :class:`Directory`. |
| 414 | |
| 415 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 416 | .. method:: set_current() |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 417 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 418 | Make this feature the current feature of :mod:`msilib`. New components are |
| 419 | automatically added to the default feature, unless a feature is explicitly |
| 420 | specified. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 421 | |
| 422 | |
| 423 | .. seealso:: |
| 424 | |
Georg Brandl | 628e6f9 | 2009-10-27 20:24:45 +0000 | [diff] [blame] | 425 | `Feature Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/feature_table.asp>`_ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 426 | |
| 427 | .. _msi-gui: |
| 428 | |
| 429 | GUI classes |
| 430 | ----------- |
| 431 | |
| 432 | :mod:`msilib` provides several classes that wrap the GUI tables in an MSI |
| 433 | database. However, no standard user interface is provided; use :mod:`bdist_msi` |
| 434 | to create MSI files with a user-interface for installing Python packages. |
| 435 | |
| 436 | |
| 437 | .. class:: Control(dlg, name) |
| 438 | |
| 439 | Base class of the dialog controls. *dlg* is the dialog object the control |
| 440 | belongs to, and *name* is the control's name. |
| 441 | |
| 442 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 443 | .. method:: event(event, argument, condition=1, ordering=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 444 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 445 | Make an entry into the ``ControlEvent`` table for this control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 446 | |
| 447 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 448 | .. method:: mapping(event, attribute) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 449 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 450 | Make an entry into the ``EventMapping`` table for this control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 451 | |
| 452 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 453 | .. method:: condition(action, condition) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 454 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 455 | Make an entry into the ``ControlCondition`` table for this control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 456 | |
| 457 | |
| 458 | .. class:: RadioButtonGroup(dlg, name, property) |
| 459 | |
| 460 | Create a radio button control named *name*. *property* is the installer property |
| 461 | that gets set when a radio button is selected. |
| 462 | |
| 463 | |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 464 | .. method:: add(name, x, y, width, height, text, value=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 465 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 466 | Add a radio button named *name* to the group, at the coordinates *x*, *y*, |
Georg Brandl | cd7f32b | 2009-06-08 09:13:45 +0000 | [diff] [blame] | 467 | *width*, *height*, and with the label *text*. If *value* is ``None``, it |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 468 | defaults to *name*. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 469 | |
| 470 | |
| 471 | .. class:: Dialog(db, name, x, y, w, h, attr, title, first, default, cancel) |
| 472 | |
| 473 | Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is made, |
| 474 | with the specified coordinates, dialog attributes, title, name of the first, |
| 475 | default, and cancel controls. |
| 476 | |
| 477 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 478 | .. method:: control(name, type, x, y, width, height, attributes, property, text, control_next, help) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 479 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 480 | Return a new :class:`Control` object. An entry in the ``Control`` table is |
| 481 | made with the specified parameters. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 482 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 483 | This is a generic method; for specific types, specialized methods are |
| 484 | provided. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 485 | |
| 486 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 487 | .. method:: text(name, x, y, width, height, attributes, text) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 488 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 489 | Add and return a ``Text`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 490 | |
| 491 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 492 | .. method:: bitmap(name, x, y, width, height, text) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 493 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 494 | Add and return a ``Bitmap`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 495 | |
| 496 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 497 | .. method:: line(name, x, y, width, height) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 498 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 499 | Add and return a ``Line`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 500 | |
| 501 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 502 | .. method:: pushbutton(name, x, y, width, height, attributes, text, next_control) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 503 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 504 | Add and return a ``PushButton`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 505 | |
| 506 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 507 | .. method:: radiogroup(name, x, y, width, height, attributes, property, text, next_control) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 508 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 509 | Add and return a ``RadioButtonGroup`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 510 | |
| 511 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 512 | .. method:: checkbox(name, x, y, width, height, attributes, property, text, next_control) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 513 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 514 | Add and return a ``CheckBox`` control. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 515 | |
| 516 | |
| 517 | .. seealso:: |
| 518 | |
Georg Brandl | 628e6f9 | 2009-10-27 20:24:45 +0000 | [diff] [blame] | 519 | `Dialog Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/dialog_table.asp>`_ |
| 520 | `Control Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/control_table.asp>`_ |
| 521 | `Control Types <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controls.asp>`_ |
| 522 | `ControlCondition Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlcondition_table.asp>`_ |
| 523 | `ControlEvent Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp>`_ |
| 524 | `EventMapping Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/eventmapping_table.asp>`_ |
| 525 | `RadioButton Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/radiobutton_table.asp>`_ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 526 | |
| 527 | .. _msi-tables: |
| 528 | |
| 529 | Precomputed tables |
| 530 | ------------------ |
| 531 | |
| 532 | :mod:`msilib` provides a few subpackages that contain only schema and table |
| 533 | definitions. Currently, these definitions are based on MSI version 2.0. |
| 534 | |
| 535 | |
| 536 | .. data:: schema |
| 537 | |
| 538 | This is the standard MSI schema for MSI 2.0, with the *tables* variable |
| 539 | providing a list of table definitions, and *_Validation_records* providing the |
| 540 | data for MSI validation. |
| 541 | |
| 542 | |
| 543 | .. data:: sequence |
| 544 | |
| 545 | This module contains table contents for the standard sequence tables: |
| 546 | *AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*, |
| 547 | *InstallExecuteSequence*, and *InstallUISequence*. |
| 548 | |
| 549 | |
| 550 | .. data:: text |
| 551 | |
| 552 | This module contains definitions for the UIText and ActionText tables, for the |
| 553 | standard installer actions. |