[Distutils] The "dist" command

M.-A. Lemburg mal@lemburg.com
Sun, 26 Sep 1999 19:16:59 +0200


Fred L. Drake, Jr. wrote:
> 
> M.-A. Lemburg writes:
>  > In my packaging tool I also have the notion of directory local
>  > manifest files, ie. the local manifest can override the global
>  > patterns to e.g. include files that would normally be excluded.
> 
>   Hmm.  Thinking about using manifest files which are fully explicit,
> perhaps the syntax should be reconsidered.  Perhaps each line should
> start with a known token, from the set "include", "file", "dir".
> "include" could be used to include a subdirectory's local manifest.
> All file/directory names should be resolved relative to the manifest
> file that contains the name, and should never refer to parent
> directories.  For example:
> 
>         include tools/MANIFEST
>         file    README INSTALL COPYING
>         file    setup.py
>         dir     docs

Please also add 'exclude' to the list (presuming you mean patterns
here and not single files).
 
Here are my defaults:

# Source distribution

SOURCE_INCLUDE = [
    '\.py','\.c','\.h','\.cc','\.cpp','\.cxx','\.html','\.zip', '\.gz',
    'Setup.in','Makefile.pre.in','\.sit','\.bat','\.ps','\.pdf',
    '\.pyd','\.def','README.*','\.pkg','\.patch','\.htm','\.i','\.swig',
    '<dir>','\.gif','\.jpg','\.hqx','LICENSE.*']

SOURCE_EXCLUDE = [
    'private.*','config.c','~','orig.*','\.pkgfiles']

# Binary distribution

BINARY_INCLUDE = [
    '\.pyo','\.so','\.lib','\.pyc','\.html','\.htm','\.gif','\.jpg',
    '\.dll','\.exe','\.pyd','README.*','\.sit','\.bat','\.ps','\.pdf',
    '\.zip','\.gz','<exec>','<dir>','\.hqx','LICENSE.*' ]

BINARY_EXCLUDE = [ 
    'private.*','~','orig.*' ]

The lists are passed to a filter function which does the following:
"""
        The patterns in include and exclude are matched using
        re.search (a $ is appended to the pattern prior to processing
        it). First the path must match at least one pattern in include
        and then not match any pattern in exclude.

	To enhance the file search, additional qualifiers may be
	given. These are prepended to the pattern and must be enclosed
	in angular brackets (<>). The following qualifiers are
	implemented:

	<exec>       only matches if the path is user executable
        <dir>        only matches if the path is a directory
	<subdir>     synonym for <dir>

	After successful qualifier test, the qualifier is removed from
	the pattern and normal pattern matching takes place.
"""

>  > Also, I have two possibilities for choosing the manifest:
>  > one for source distribution and one for binary distribution.
>  > Something like it in distutils would be nice too.
> 
>   This is cool; as long as the manifest can be specified from the
> command line it should be easy to adjust the defaulting of the
> filename:  if MANIFEST.SRC is present, it is used for the source dist,
> otherwise use MANIFEST, or the default rules.  The same for
> MANIFEST.BIN.  (Or whatever names they have.)

That should work... using an option to specify the MANIFEST
extension I mean. It would even allow other standard
classifications as well, e.g. for specific platforms, customers,
editions, etc.
 
>  > Note that it would also be nice to have "dist" produce a meta
>  > information Python module that it automatically includes in the
> 
>   What would this contain and how would it be used?

I guess all the information used as setup information for
distutils. This would be useful for a rpm like tool that allows
you to query the installed packages using this meta information.
 
>  > Which options for the archive format do you consider ?
>  > I'm currently using .zip, .tar.gz, .tgz, .tar.bz2 and .tz2.
> 
>   Seems like all can be supported and selected by configuration and
> command line option.
> 
>  > Just in case you have missed my current tool set:
>  >
>  >      http://starship.skyport.net/~lemburg/pkgtools-0.1.0.zip
> 
>   Hmm, no README, INSTALL, or LICENSE....  I'll see if I can figure it
> out!  ;-)  Thanks for the pointer.

Things should be pretty obvious. Just run the tools with
-h and they'll tell you a whole lot about themselves :-) Can't
remember all those options myself...

Note that I've been using the pkgcreate script for quite a while
now, so it fits the task for my purposes rather well, YMMV.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    98 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/