[Distutils] PEP 376 Status

David Cournapeau cournape at gmail.com
Tue Mar 30 09:59:49 CEST 2010


On Tue, Mar 30, 2010 at 5:37 AM, Floris Bruynooghe
<floris.bruynooghe at gmail.com> wrote:

> This work calls for a systemwide sysconfig.cfg file which maps the
> categories onto system locations.  I notice the example one contains
> sections for "posix" and "posix_home" (among others), presumably the
> "posix_home" one is for when using "setup.py --home".  But what about
> the user site-packages directory (setup.py --user)?  Would it make
> sense to have a sysconfig.cfg (or equivalent) file in the user
> site-packages too?

I am not sure what you mean but systemwide sysconfig. Do you mean to
override defaults ?

Concerning toydist, the scheme is as simple as I could make it. First,
toydist has an internal dict which copies autoconf:

scheme = {
        'prefix': '/usr/local',
        'eprefix': '$prefix',
        'bindir': '$eprefix/bin',
        'sbindir': '$eprefix/sbin',
        ....
}

Then, the build command of the command line interface to toydist
produces a manifest file which produces the list of files to be
installed, classified category-wise (python files, extensions,
bytecode, etc...). Each category has one installation path attached to
it (which are *not* resolved at that point, i.e. the values still
contain the $variables form). The $variables are resolved at *install*
time: this enables production of both "normal" installation and
eggs/wininst/etc... from the same manifest file, as the installation
path is resolved by the corresponding install command.

With this system, I can also support the FHS-compliant scheme (default
on unix), the Mac OS X-way on mac os X, the windows way on windows,
and --user/--prefix options without changing any of the logic.

This is also quite flexible from a user POV, because toydist has the
notion of datafile sections, which can have an arbitrary installation
path attached to it (and toydist allows the creation of new $path
variable), and can be itself referenced as a $path variable.


> Lastly has toydist's "toysetup.info" from David Cournapeau been
> considered in the discussions on setup.cfg for distutils2?  It's a
> pretty nice format and it actually has an implementation too.

Note that most of the syntax is stolen from cabal, so I don't deserve
the credit. The implementation still has issues, though:
 - there is no support for Unicode (but this should not be too
difficult to solve, mostly a matter of tweaking a few regex in the
lexer)
 - the parser uses PLY to define the lexer and grammar
 - it is relatively slow

I am sure people familiar with parsing algos can come up with
something much better here - although PLY is quite small as a
dependency.

There is also experimental support to automatically convert setup.py
to the format (it cannot be reliable because of inherent distutils
fragility, but it can already convert reasonable packages such as
virtualenv, Jinja2 or sphinx).

> Currently it seems a lot
> more verbose for tagging files under categories compared to the
> proposed setup.cfg

I am not sure to understand what you are referring to ? Do you mean this:

DataFiles: mandoc
    SourceDir: doc/man
    TargetDir: $manpath
    Files: man1/foo1, man3/foo3

I would be glad to hear suggestion on a better syntax, but note that
both SourceDir and TargetDir are necessary to support all the features
I want to (in particular nobase install mode as available in
automake).

> but that might not be set in stone and I hope
> David will be happy to incorporate reasonable proposals if this is
> preceived to be a problem.

Toydist is completely experimental at that point, and anything subject
to change - as suggested by its name, it is more a playground to
experiment things than a real tool (although I certainly intend to
make a real alternative to distutils/setuptools from it in the
future).

David


More information about the Distutils-SIG mailing list