Sitemap

Running Installer
Python Archives
Standalones
The MEInc.Dist package
Frequently Asked Questions
Extensions

The underlying modules

Most of the smarts that used to be hard-coded into Builder is now factored out into modules of the MEInc.Dist package. These are finder, ltoc, tocfilter and resource.

The finder module first finds a file corresponding to the name it is given, and then determines the file's type. It will search PYTHONPATH and any extra path arguments you feed it (through the pathprefix= option). These paths are extended by adding any directories in that are found to be packages. (So you do not need to specify "Package.module" - it will find "module", and realize that it is part of "Package".) If this search fails, it will also try the PATH environment variable.

The resource module is centered around the concept of resources. Resources come in the following types:

scriptresource
A Python top level script.
moduleresource
A Python module.
pkgresource
A Python package.
binaryresource
A .dll or .pyd.
dataresource
An arbitrary file.
archiveresource
A CArchive.
zlibresource
A ZlibArchive.
dirresource
A directory.
treeresource
A directory and subdirectories.

All of the Python resources know how to analyze themselves and find their Python and binary dependencies. Binary resources know how to find their own binary dependencies. All resources have a contents method. For a singular type, this just returns a list with itself as the only entry. For plural types of resources, this returns a list of everything contained therein (the list elements being resources).

There is a module level factory function, makeresource(name, xtrapath=None) which uses finder to figure out what type of resource name refers to.

The tocfilter module has a bunch of different classes corresponding to the different ways of excluding files. For some types of filters, it will also use finder to figure out what you mean, (in fact, you can create a filter from a resource).

The ltoc module is concerned with managing lists of resources. It is generally list-like, with a couple twists. One is a merge(other) method which will combine two ltocs, preserving order of the first, and discarding duplicates.

The other twist is the filter() method, which applies a set of tocfilters to the ltoc's contents.

Putting it together, you will generally start by specifying what resources you are interested in. For Python resources, you may or may not want to expand this to their Python and/or binary dependencies. You then build an ltoc by asking each resource for its contents, and merging these in. Then you apply filters to the ltoc. Finally, you can build an archive (CArchive being the most general type of archive) from the ltoc.

With a little bit of special casing, that's (almost) all that Builder does. The syntax of a config file, however, makes it difficult to specify all the possible combinations of resources, filters etc. that you can do by using finder and ltoc directly. Subclasses of resource and filter should also be fairly easy to do.

Also in the MEInc.Dist package is a module called icon. This module is a gift from Thomas Heller (thank you very much, Thomas, for this and your other contributions!). It performs the magic required to change the icon of the exe you build.

copyright 1999-2001
McMillan Enterprises, Inc.