[Distutils] And a proposed new manifest syntax

Greg Ward gward@cnri.reston.va.us
Sun, 6 Feb 2000 19:56:29 -0500


...picking up where I left earlier today, here's my proposed new syntax
for the MANIFEST.in file.  Note that the semantics are the same as the
existing MANIFEST, but it should be a) easier to read, b) easier to
write, and c) easier to understand the results (thanks to the division
of labour between MANIFEST.in and MANIFEST -- see my earlier post).

The requirements for the MANIFEST.in syntax is that the developer must
be able to include or exclude files by

  - exact path (including wildcards -- "foo/bar.py" is just a
    special case of "foo/*.py")
  - wildcard applied recursively throughout a directory subtree

And of course the MANIFEST.in file must be clear, concise, and
expressive.  The existing syntax is already concise and expressive, but
pssbly a lttl too cncse.

In my proposed syntax, there are four types of lines in the MANIFEST.in
file:

  <path>             
    include exactly the specified file(s) (path can be a complete
    directory specification ending with a wildcard, eg. "foo.py",
    "bar/README.txt", "qux/*.c")
  exclude <path>
    exclude exactly the specified file(s)
  recursive <path>
    split <path> into <dirname> and <basename>; recursively include all
    files under <dirname> that match <basename>
  recursive-exclude <path>
    you figure it out ;-)

Possible points of contention (not "open issues" because I've pretty
much made up my mind -- but I am willing to consider the existence of
unenlightened heathens who dare to disagree ;-):

  * no "include" keyword -- clarity/concision tradeoff
  * no wildcards on directories, ie. "foo/bar/*.py" is OK, but
    not "foo/*/bar.py"

A subtlety that I don't think I've mentioned very widely: like in the
setup script, paths would be delimited with a forward slash rather than
using the local convention.  (Distutils explicitly does "string.split
(..., '/')" in many places -- this is a feature, as the resulting list
is then put back together with 'os.path.join()' before being used in the
real world.)  The purpose is the same for both the setup script and
MANIFEST.in -- portability.

As an example, here's how the MANIFEST file for Distutils 0.1.3 would
look with the new syntax:

  *.txt
  examples/*.txt
  examples/*.py
  exclude distutils/command/build_lib.py

So -- opinions?  I'll probably implement the new 'dist' command in the
next few days, so get back to me soon if you think I'm doing it wrong.

        Greg