2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
:mod:`msilib` --- Read and write Microsoft Installer files
|
|
|
|
==========================================================
|
|
|
|
|
|
|
|
.. module:: msilib
|
|
|
|
:platform: Windows
|
|
|
|
:synopsis: Creation of Microsoft Installer files, and CAB files.
|
|
|
|
.. moduleauthor:: Martin v. Löwis <martin@v.loewis.de>
|
|
|
|
.. sectionauthor:: Martin v. Löwis <martin@v.loewis.de>
|
|
|
|
|
|
|
|
|
|
|
|
.. index:: single: msi
|
|
|
|
|
|
|
|
The :mod:`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 :mod:`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.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: FCICreate(cabname, files)
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
Merged revisions 59703-59773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line
Moved include "Python.h" in front of other imports to silence a warning.
........
r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines
Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
........
r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines
Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
........
r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line
Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
........
r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines
Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.
(will backport to 2.5)
........
r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line
Update links to bug/patch tracker
........
r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
........
r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line
And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro!
........
r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line
Reverted last transaction. It's the wrong branch.
........
r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line
socket.ioctl is only available on Windows
........
r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line
Fix markup
........
r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
........
r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
........
r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
........
r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line
Add error-checking to namedtuple's _replace() method.
........
r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines
clean up a comment
........
r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
........
r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line
Fix comment typo
........
r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line
Add myself.
........
r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines
Fix C++-style comment.
........
r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines
Remove with_statement future imports from 2.6 docs.
........
r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines
Simplify index entries; fix #1712.
........
r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
........
r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines
Revert socket.rst to unix-eol.
........
r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines
Set native svn:eol-style property for text files.
........
r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines
#1719: capitalization error in "UuidCreate".
........
r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines
Repair markup.
........
r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines
Use markup.
........
r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line
Final adjustments for #1601
........
r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines
Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
........
r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines
Add John Nagle (of issue #1637).
........
r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line
Small code simplification. Forgot that classmethods can be called from intances.
........
r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines
Use vcbuild for VS 2009.
........
r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines
Package using VS 2008.
........
r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines
Don't try to package msvcr90 for the moment.
........
r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines
#1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
........
r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
........
r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines
#1591: Clarify docstring of Popen3.
........
r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines
#1680: fix context manager example function name.
........
r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines
#1755097: document default values for [].sort() and sorted().
........
2008-01-06 12:59:19 -04:00
|
|
|
.. function:: UuidCreate()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return the string representation of a new unique identifier. This wraps the
|
|
|
|
Windows API functions :cfunc:`UuidCreate` and :cfunc:`UuidToString`.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: OpenDatabase(path, persist)
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: CreateRecord(count)
|
|
|
|
|
|
|
|
Return a new record object by calling :cfunc:`MSICreateRecord`. *count* is the
|
|
|
|
number of fields of the record.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: init_database(name, schema, ProductName, ProductCode, ProductVersion, Manufacturer)
|
|
|
|
|
|
|
|
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, :mod:`msilib.schema` should be
|
|
|
|
used.
|
|
|
|
|
|
|
|
The database will contain just the schema and the validation records when this
|
|
|
|
function returns.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: add_data(database, records)
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2007-11-29 13:41:05 -04:00
|
|
|
Field values can be integers, strings, or instances of the Binary class.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. class:: Binary(filename)
|
|
|
|
|
|
|
|
Represents entries in the Binary table; inserting such an object using
|
|
|
|
:func:`add_data` reads the file named *filename* into the table.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: add_tables(database, module)
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: add_stream(database, name, path)
|
|
|
|
|
|
|
|
Add the file *path* into the ``_Stream`` table of *database*, with the stream
|
|
|
|
name *name*.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: gen_uuid()
|
|
|
|
|
|
|
|
Return a new UUID, in the format that MSI typically requires (i.e. in curly
|
|
|
|
braces, and with all hexdigits in upper-case).
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`FCICreateFile <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devnotes/winprog/fcicreate.asp>`_
|
|
|
|
`UuidCreate <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/uuidcreate.asp>`_
|
|
|
|
`UuidToString <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/uuidtostring.asp>`_
|
|
|
|
|
|
|
|
.. _database-objects:
|
|
|
|
|
|
|
|
Database Objects
|
|
|
|
----------------
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Database.OpenView(sql)
|
|
|
|
|
|
|
|
Return a view object, by calling :cfunc:`MSIDatabaseOpenView`. *sql* is the SQL
|
|
|
|
statement to execute.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Database.Commit()
|
|
|
|
|
|
|
|
Commit the changes pending in the current transaction, by calling
|
|
|
|
:cfunc:`MSIDatabaseCommit`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Database.GetSummaryInformation(count)
|
|
|
|
|
|
|
|
Return a new summary information object, by calling
|
|
|
|
:cfunc:`MsiGetSummaryInformation`. *count* is the maximum number of updated
|
|
|
|
values.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59987 | raymond.hettinger | 2008-01-15 21:52:42 +0100 (Tue, 15 Jan 2008) | 1 line
Refactor if/elif chain for clarity and speed. Remove dependency on subclasses having to implement _empty and _full.
........
r59988 | raymond.hettinger | 2008-01-15 22:22:47 +0100 (Tue, 15 Jan 2008) | 1 line
Fix-up half-written paragraph in the docs
........
r59989 | amaury.forgeotdarc | 2008-01-15 22:25:11 +0100 (Tue, 15 Jan 2008) | 3 lines
test_doctest fails since r59984.
Not sure if these are the correct values, but save_stdout has to be set before its usage...
........
r59992 | andrew.kuchling | 2008-01-16 01:32:03 +0100 (Wed, 16 Jan 2008) | 1 line
Docstring typos
........
r59993 | andrew.kuchling | 2008-01-16 04:17:25 +0100 (Wed, 16 Jan 2008) | 1 line
Add PEP 3141 section
........
r59998 | andrew.kuchling | 2008-01-16 14:01:51 +0100 (Wed, 16 Jan 2008) | 1 line
Markup fix
........
r59999 | georg.brandl | 2008-01-16 17:56:29 +0100 (Wed, 16 Jan 2008) | 2 lines
Fix MSDN library URL. (#1854)
........
r60006 | georg.brandl | 2008-01-16 21:27:56 +0100 (Wed, 16 Jan 2008) | 3 lines
Add Python-specific content to Doc dir. Update configuration file
to work with the newest Sphinx.
........
r60007 | georg.brandl | 2008-01-16 21:29:00 +0100 (Wed, 16 Jan 2008) | 2 lines
Doc build should work with 2.4 now.
........
r60009 | raymond.hettinger | 2008-01-17 00:38:16 +0100 (Thu, 17 Jan 2008) | 1 line
Minor wordsmithing.
........
r60010 | raymond.hettinger | 2008-01-17 00:40:45 +0100 (Thu, 17 Jan 2008) | 1 line
Add queues will alternative fetch orders (priority based and stack based).
........
r60011 | raymond.hettinger | 2008-01-17 00:49:35 +0100 (Thu, 17 Jan 2008) | 1 line
Add news entry.
........
r60013 | raymond.hettinger | 2008-01-17 04:02:14 +0100 (Thu, 17 Jan 2008) | 1 line
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
........
r60015 | gregory.p.smith | 2008-01-17 08:43:20 +0100 (Thu, 17 Jan 2008) | 3 lines
Comply with RFC 3207.
Fixes issue 829951 - http://bugs.python.org/issue829951
........
r60018 | gregory.p.smith | 2008-01-17 09:03:17 +0100 (Thu, 17 Jan 2008) | 2 lines
entry for r60015
........
r60019 | raymond.hettinger | 2008-01-17 09:07:05 +0100 (Thu, 17 Jan 2008) | 1 line
Note versionadded.
........
r60020 | gregory.p.smith | 2008-01-17 09:35:49 +0100 (Thu, 17 Jan 2008) | 8 lines
Fixes (accepts patch) issue1339 - http://bugs.python.org/issue1339
- Factor out the duplication of EHLO/HELO in login() and sendmail() to
a new function, ehlo_or_helo_if_needed().
- Use ehlo_or_helo_if_needed() in starttls()
- Check for the starttls exception in starttls() in the same way as
login() checks for the auth extension.
Contributed by Bill Fenner.
........
r60021 | andrew.kuchling | 2008-01-17 13:00:15 +0100 (Thu, 17 Jan 2008) | 1 line
Revise 3141 section a bit; add some Windows items
........
r60022 | brett.cannon | 2008-01-17 19:45:10 +0100 (Thu, 17 Jan 2008) | 2 lines
Fix a function pointer declaration to silence the compiler.
........
r60024 | raymond.hettinger | 2008-01-17 20:31:38 +0100 (Thu, 17 Jan 2008) | 1 line
Issue #1861: Add read-only attribute listing upcoming events in the order they will be run.
........
r60025 | andrew.kuchling | 2008-01-17 20:49:24 +0100 (Thu, 17 Jan 2008) | 1 line
Correction from Jordan Lewis: halfdelay() uses tenths of a second, not milliseconds
........
r60026 | raymond.hettinger | 2008-01-17 23:27:49 +0100 (Thu, 17 Jan 2008) | 1 line
Add advice on choosing between scheduler and threading.Timer().
........
r60028 | christian.heimes | 2008-01-18 00:01:44 +0100 (Fri, 18 Jan 2008) | 2 lines
Updated new property syntax. An elaborate example for subclassing and the getter was missing.
Added comment about VS 2008 and PGO builds.
........
r60029 | raymond.hettinger | 2008-01-18 00:32:01 +0100 (Fri, 18 Jan 2008) | 1 line
Fix-up Timer() example.
........
r60030 | raymond.hettinger | 2008-01-18 00:56:56 +0100 (Fri, 18 Jan 2008) | 1 line
Fix markup
........
r60031 | raymond.hettinger | 2008-01-18 01:10:42 +0100 (Fri, 18 Jan 2008) | 1 line
clearcache() needs to remove the dict as well as clear it.
........
r60033 | andrew.kuchling | 2008-01-18 03:26:16 +0100 (Fri, 18 Jan 2008) | 1 line
Bump verson
........
r60034 | andrew.kuchling | 2008-01-18 03:42:52 +0100 (Fri, 18 Jan 2008) | 1 line
Typo fix
........
r60035 | christian.heimes | 2008-01-18 08:30:20 +0100 (Fri, 18 Jan 2008) | 3 lines
Coverity issue CID #197
var_decl: Declared variable "stm" without initializer
ninit_use_in_call: Using uninitialized value "stm" (field "stm".tm_zone uninitialized) in call to function "mktime"
........
r60036 | christian.heimes | 2008-01-18 08:45:30 +0100 (Fri, 18 Jan 2008) | 11 lines
Coverity issue CID #167
Event alloc_fn: Called allocation function "metacompile" [model]
Event var_assign: Assigned variable "gr" to storage returned from "metacompile"
gr = metacompile(n);
Event pass_arg: Variable "gr" not freed or pointed-to in function "maketables" [model]
g = maketables(gr);
translatelabels(g);
addfirstsets(g);
Event leaked_storage: Returned without freeing storage "gr"
return g;
........
r60038 | christian.heimes | 2008-01-18 09:04:57 +0100 (Fri, 18 Jan 2008) | 3 lines
Coverity issue CID #182
size_error: Allocating 1 bytes to pointer "children", which needs at least 4 bytes
........
r60041 | christian.heimes | 2008-01-18 09:47:59 +0100 (Fri, 18 Jan 2008) | 4 lines
Coverity issue CID #169
local_ptr_assign_local: Assigning address of stack variable "namebuf" to pointer "filename"
out_of_scope: Variable "namebuf" goes out of scope
use_invalid: Used "filename" pointing to out-of-scope variable "namebuf"
........
r60042 | christian.heimes | 2008-01-18 09:53:45 +0100 (Fri, 18 Jan 2008) | 2 lines
Coverity CID #168
leaked_storage: Returned without freeing storage "fp"
........
2008-01-18 05:56:22 -04:00
|
|
|
`MSIDatabaseOpenView <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabaseopenview.asp>`_
|
2007-08-15 11:28:22 -03:00
|
|
|
`MSIDatabaseCommit <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabasecommit.asp>`_
|
|
|
|
`MSIGetSummaryInformation <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msigetsummaryinformation.asp>`_
|
|
|
|
|
|
|
|
.. _view-objects:
|
|
|
|
|
|
|
|
View Objects
|
|
|
|
------------
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: View.Execute([params=None])
|
|
|
|
|
|
|
|
Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. *params* is
|
|
|
|
an optional record describing actual values of the parameter tokens in the
|
|
|
|
query.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: View.GetColumnInfo(kind)
|
|
|
|
|
|
|
|
Return a record describing the columns of the view, through calling
|
|
|
|
:cfunc:`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or
|
|
|
|
``MSICOLINFO_TYPES``.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: View.Fetch()
|
|
|
|
|
|
|
|
Return a result record of the query, through calling :cfunc:`MsiViewFetch`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: View.Modify(kind, data)
|
|
|
|
|
|
|
|
Modify the view, by calling :cfunc:`MsiViewModify`. *kind* can be one of
|
|
|
|
``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``,
|
|
|
|
``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``,
|
|
|
|
``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``,
|
|
|
|
``MSIMODIFY_VALIDATE``, ``MSIMODIFY_VALIDATE_NEW``,
|
|
|
|
``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``.
|
|
|
|
|
|
|
|
*data* must be a record describing the new data.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: View.Close()
|
|
|
|
|
|
|
|
Close the view, through :cfunc:`MsiViewClose`.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`MsiViewExecute <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewexecute.asp>`_
|
|
|
|
`MSIViewGetColumnInfo <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewgetcolumninfo.asp>`_
|
|
|
|
`MsiViewFetch <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewfetch.asp>`_
|
|
|
|
`MsiViewModify <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewmodify.asp>`_
|
|
|
|
`MsiViewClose <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiviewclose.asp>`_
|
|
|
|
|
|
|
|
.. _summary-objects:
|
|
|
|
|
|
|
|
Summary Information Objects
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: SummaryInformation.GetProperty(field)
|
|
|
|
|
|
|
|
Return a property of the summary, through :cfunc:`MsiSummaryInfoGetProperty`.
|
|
|
|
*field* is the name of the property, and can be one of the constants
|
|
|
|
``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, ``PID_AUTHOR``,
|
|
|
|
``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, ``PID_LASTAUTHOR``,
|
|
|
|
``PID_REVNUMBER``, ``PID_LASTPRINTED``, ``PID_CREATE_DTM``,
|
|
|
|
``PID_LASTSAVE_DTM``, ``PID_PAGECOUNT``, ``PID_WORDCOUNT``, ``PID_CHARCOUNT``,
|
|
|
|
``PID_APPNAME``, or ``PID_SECURITY``.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: SummaryInformation.GetPropertyCount()
|
|
|
|
|
|
|
|
Return the number of summary properties, through
|
|
|
|
:cfunc:`MsiSummaryInfoGetPropertyCount`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: SummaryInformation.SetProperty(field, value)
|
|
|
|
|
|
|
|
Set a property through :cfunc:`MsiSummaryInfoSetProperty`. *field* can have the
|
|
|
|
same values as in :meth:`GetProperty`, *value* is the new value of the property.
|
|
|
|
Possible value types are integer and string.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: SummaryInformation.Persist()
|
|
|
|
|
|
|
|
Write the modified properties to the summary information stream, using
|
|
|
|
:cfunc:`MsiSummaryInfoPersist`.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`MsiSummaryInfoGetProperty <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfogetproperty.asp>`_
|
|
|
|
`MsiSummaryInfoGetPropertyCount <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfogetpropertycount.asp>`_
|
|
|
|
`MsiSummaryInfoSetProperty <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfosetproperty.asp>`_
|
|
|
|
`MsiSummaryInfoPersist <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msisummaryinfopersist.asp>`_
|
|
|
|
|
|
|
|
.. _record-objects:
|
|
|
|
|
|
|
|
Record Objects
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Record.GetFieldCount()
|
|
|
|
|
|
|
|
Return the number of fields of the record, through
|
|
|
|
:cfunc:`MsiRecordGetFieldCount`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Record.SetString(field, value)
|
|
|
|
|
|
|
|
Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an
|
|
|
|
integer; *value* a string.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Record.SetStream(field, value)
|
|
|
|
|
|
|
|
Set *field* to the contents of the file named *value*, through
|
|
|
|
:cfunc:`MsiRecordSetStream`. *field* must be an integer; *value* a string.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Record.SetInteger(field, value)
|
|
|
|
|
|
|
|
Set *field* to *value* through :cfunc:`MsiRecordSetInteger`. Both *field* and
|
|
|
|
*value* must be an integer.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Record.ClearData()
|
|
|
|
|
|
|
|
Set all fields of the record to 0, through :cfunc:`MsiRecordClearData`.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`MsiRecordGetFieldCount <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordgetfieldcount.asp>`_
|
|
|
|
`MsiRecordSetString <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetstring.asp>`_
|
|
|
|
`MsiRecordSetStream <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetstream.asp>`_
|
|
|
|
`MsiRecordSetInteger <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordsetinteger.asp>`_
|
|
|
|
`MsiRecordClear <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msirecordclear.asp>`_
|
|
|
|
|
|
|
|
.. _msi-errors:
|
|
|
|
|
|
|
|
Errors
|
|
|
|
------
|
|
|
|
|
|
|
|
All wrappers around MSI functions raise :exc:`MsiError`; the string inside the
|
|
|
|
exception will contain more detail.
|
|
|
|
|
|
|
|
|
|
|
|
.. _cab:
|
|
|
|
|
|
|
|
CAB Objects
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: CAB(name)
|
|
|
|
|
|
|
|
The class :class:`CAB` represents a CAB file. During MSI construction, files
|
|
|
|
will be added simultaneously to the ``Files`` table, and to a CAB file. Then,
|
|
|
|
when all files have been added, the CAB file can be written, then added to the
|
|
|
|
MSI file.
|
|
|
|
|
|
|
|
*name* is the name of the CAB file in the MSI file.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: CAB.append(full, file, logical)
|
|
|
|
|
|
|
|
Add the file with the pathname *full* to the CAB file, under the name *logical*.
|
|
|
|
If there is already a file named *logical*, a new file name is created.
|
|
|
|
|
|
|
|
Return the index of the file in the CAB file, and the new name of the file
|
|
|
|
inside the CAB file.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: CAB.commit(database)
|
|
|
|
|
|
|
|
Generate a CAB file, add it as a stream to the MSI file, put it into the
|
|
|
|
``Media`` table, and remove the generated file from the disk.
|
|
|
|
|
|
|
|
|
|
|
|
.. _msi-directory:
|
|
|
|
|
|
|
|
Directory Objects
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: Directory(database, cab, basedir, physical, logical, default, component, [componentflags])
|
|
|
|
|
|
|
|
Create a new directory in the Directory table. There is a current component at
|
|
|
|
each point in time for the directory, which is either explicitly created through
|
|
|
|
:meth:`start_component`, or implicitly when files are added for the first time.
|
|
|
|
Files are added into the current component, and into the cab file. To create a
|
|
|
|
directory, a base directory object needs to be specified (can be ``None``), the
|
|
|
|
path to the physical directory, and a logical directory name. *default*
|
|
|
|
specifies the DefaultDir slot in the directory table. *componentflags* specifies
|
|
|
|
the default flags that new components get.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Directory.start_component([component[, feature[, flags[, keyfile[, uuid]]]]])
|
|
|
|
|
|
|
|
Add an entry to the Component table, and make this component the current
|
|
|
|
component for this directory. If no component name is given, the directory name
|
|
|
|
is used. If no *feature* is given, the current feature is used. If no *flags*
|
|
|
|
are given, the directory's default flags are used. If no *keyfile* is given, the
|
|
|
|
KeyPath is left null in the Component table.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Directory.add_file(file[, src[, version[, language]]])
|
|
|
|
|
|
|
|
Add a file to the current component of the directory, starting a new one if
|
|
|
|
there is no current component. By default, the file name in the source and the
|
|
|
|
file table will be identical. If the *src* file is specified, it is interpreted
|
|
|
|
relative to the current directory. Optionally, a *version* and a *language* can
|
|
|
|
be specified for the entry in the File table.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Directory.glob(pattern[, exclude])
|
|
|
|
|
|
|
|
Add a list of files to the current component as specified in the glob pattern.
|
|
|
|
Individual files can be excluded in the *exclude* list.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Directory.remove_pyc()
|
|
|
|
|
|
|
|
Remove ``.pyc``/``.pyo`` files on uninstall.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`Directory Table <http://msdn.microsoft.com/library/en-us/msi/setup/directory_table.asp>`_
|
|
|
|
`File Table <http://msdn.microsoft.com/library/en-us/msi/setup/file_table.asp>`_
|
|
|
|
`Component Table <http://msdn.microsoft.com/library/en-us/msi/setup/component_table.asp>`_
|
|
|
|
`FeatureComponents Table <http://msdn.microsoft.com/library/en-us/msi/setup/featurecomponents_table.asp>`_
|
|
|
|
|
|
|
|
.. _features:
|
|
|
|
|
|
|
|
Features
|
|
|
|
--------
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: Feature(database, id, title, desc, display[, level=1[, parent[, directory[, attributes=0]]]])
|
|
|
|
|
|
|
|
Add a new record to the ``Feature`` table, using the values *id*, *parent.id*,
|
|
|
|
*title*, *desc*, *display*, *level*, *directory*, and *attributes*. The
|
|
|
|
resulting feature object can be passed to the :meth:`start_component` method of
|
|
|
|
:class:`Directory`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Feature.set_current()
|
|
|
|
|
|
|
|
Make this feature the current feature of :mod:`msilib`. New components are
|
|
|
|
automatically added to the default feature, unless a feature is explicitly
|
|
|
|
specified.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`Feature Table <http://msdn.microsoft.com/library/en-us/msi/setup/feature_table.asp>`_
|
|
|
|
|
|
|
|
.. _msi-gui:
|
|
|
|
|
|
|
|
GUI classes
|
|
|
|
-----------
|
|
|
|
|
|
|
|
:mod:`msilib` provides several classes that wrap the GUI tables in an MSI
|
|
|
|
database. However, no standard user interface is provided; use :mod:`bdist_msi`
|
|
|
|
to create MSI files with a user-interface for installing Python packages.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: Control(dlg, name)
|
|
|
|
|
|
|
|
Base class of the dialog controls. *dlg* is the dialog object the control
|
|
|
|
belongs to, and *name* is the control's name.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Control.event(event, argument[, condition=1[, ordering]])
|
|
|
|
|
|
|
|
Make an entry into the ``ControlEvent`` table for this control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Control.mapping(event, attribute)
|
|
|
|
|
|
|
|
Make an entry into the ``EventMapping`` table for this control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Control.condition(action, condition)
|
|
|
|
|
|
|
|
Make an entry into the ``ControlCondition`` table for this control.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: RadioButtonGroup(dlg, name, property)
|
|
|
|
|
|
|
|
Create a radio button control named *name*. *property* is the installer property
|
|
|
|
that gets set when a radio button is selected.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: RadioButtonGroup.add(name, x, y, width, height, text [, value])
|
|
|
|
|
|
|
|
Add a radio button named *name* to the group, at the coordinates *x*, *y*,
|
|
|
|
*width*, *height*, and with the label *text*. If *value* is omitted, it defaults
|
|
|
|
to *name*.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: Dialog(db, name, x, y, w, h, attr, title, first, default, cancel)
|
|
|
|
|
|
|
|
Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is made,
|
|
|
|
with the specified coordinates, dialog attributes, title, name of the first,
|
|
|
|
default, and cancel controls.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.control(name, type, x, y, width, height, attributes, property, text, control_next, help)
|
|
|
|
|
|
|
|
Return a new :class:`Control` object. An entry in the ``Control`` table is made
|
|
|
|
with the specified parameters.
|
|
|
|
|
|
|
|
This is a generic method; for specific types, specialized methods are provided.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.text(name, x, y, width, height, attributes, text)
|
|
|
|
|
|
|
|
Add and return a ``Text`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.bitmap(name, x, y, width, height, text)
|
|
|
|
|
|
|
|
Add and return a ``Bitmap`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.line(name, x, y, width, height)
|
|
|
|
|
|
|
|
Add and return a ``Line`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.pushbutton(name, x, y, width, height, attributes, text, next_control)
|
|
|
|
|
|
|
|
Add and return a ``PushButton`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.radiogroup(name, x, y, width, height, attributes, property, text, next_control)
|
|
|
|
|
|
|
|
Add and return a ``RadioButtonGroup`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Dialog.checkbox(name, x, y, width, height, attributes, property, text, next_control)
|
|
|
|
|
|
|
|
Add and return a ``CheckBox`` control.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
`Dialog Table <http://msdn.microsoft.com/library/en-us/msi/setup/dialog_table.asp>`_
|
|
|
|
`Control Table <http://msdn.microsoft.com/library/en-us/msi/setup/control_table.asp>`_
|
|
|
|
`Control Types <http://msdn.microsoft.com/library/en-us/msi/setup/controls.asp>`_
|
|
|
|
`ControlCondition Table <http://msdn.microsoft.com/library/en-us/msi/setup/controlcondition_table.asp>`_
|
|
|
|
`ControlEvent Table <http://msdn.microsoft.com/library/en-us/msi/setup/controlevent_table.asp>`_
|
|
|
|
`EventMapping Table <http://msdn.microsoft.com/library/en-us/msi/setup/eventmapping_table.asp>`_
|
|
|
|
`RadioButton Table <http://msdn.microsoft.com/library/en-us/msi/setup/radiobutton_table.asp>`_
|
|
|
|
|
|
|
|
.. _msi-tables:
|
|
|
|
|
|
|
|
Precomputed tables
|
|
|
|
------------------
|
|
|
|
|
|
|
|
:mod:`msilib` provides a few subpackages that contain only schema and table
|
|
|
|
definitions. Currently, these definitions are based on MSI version 2.0.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: schema
|
|
|
|
|
|
|
|
This is the standard MSI schema for MSI 2.0, with the *tables* variable
|
|
|
|
providing a list of table definitions, and *_Validation_records* providing the
|
|
|
|
data for MSI validation.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: sequence
|
|
|
|
|
|
|
|
This module contains table contents for the standard sequence tables:
|
|
|
|
*AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*,
|
|
|
|
*InstallExecuteSequence*, and *InstallUISequence*.
|
|
|
|
|
|
|
|
|
|
|
|
.. data:: text
|
|
|
|
|
|
|
|
This module contains definitions for the UIText and ActionText tables, for the
|
|
|
|
standard installer actions.
|
|
|
|
|