[Distutils] distutils2 Forward Compatibility module

Erik Bray erik.m.bray at gmail.com
Fri Mar 18 21:05:33 CET 2011


On Thu, Mar 17, 2011 at 11:55 AM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> Hi Erik,
>
> On Thu, Mar 17, 2011 at 8:42 AM, Erik Bray <erik.m.bray at gmail.com> wrote:
>> Hi all,
>> This is my first post specifically to distutils-sig, though I've had
>> an interest in packaging for a while (having come up with some fairly
>> arcane schemes in the past, where no better alternatives were
>> apparent).
>>
>> At any rate: I'm currently working on a plan to overhaul how a number
>> of my company's projects are packaged and distributed.  Right now they
>> all rely on a monkey-patched, hacked up distutils that needs to go
>> away.  I'm already on top of that.
>>
>> But seeing as how distutils2 is going to be the "new hotness" I want
>> to plan for at as part of my overhaul.  I realize that distutils2 is
>> still in flux, and anything I do now will have to be tweaked as
>> development on it continues.  I am fine with this, as I still intend
>> to use Distribute as the primary installation mechanism.  But I really
>> like how distutils2 keeps all metadata in the setup.cfg file, and want
>> to start doing that now, so that I don't have to keep two copies of
>> everything.
>>
>> It should be no problem to just have my setup.py read everything it
>> needs out of setup.cfg, but what I'm wondering is if there is already
>> an extension to do this, or will I have to roll my own?  It just seems
>> like an obvious thing to have for transitioning to distutils2, and if
>> it doesn't already exist it should (I will of course be happy to
>> contribute).  I should note that I don't want distutils2 itself to be
>> a dependency for installing my packages, as it is too unstable, so
>> directly using any machinery built into it is out of the question.
>
> There's such a thing, look at this function here:
>
> http://hg.python.org/distutils2/file/6fca65ff60ad/distutils2/util.py#l1098
>
> It's not hooked yet to a command-line tool like mkcfg, but should be soon.
>
> Let us know how it works out for you.

I accidentally replied to this the other day directly to Tarek instead
of to the list.  At any rate, the cfg_to_args() function there is
mostly working out, after a couple bug fixes (see
http://bugs.python.org/issue11595).  I also have another patch in my
local repository that adds support for the package_data options.

But now I'm stuck wondering what the plan is for extension modules.
Different versiions of the documentation, such that it exists, say
different things.  Looking at the source code it looks like right now
each extension module is configured in a section called
[extension=<module_name>], but I wonder how likely that is to change.

Furthermore, I have many extension modules that use NumPy.  Typically,
when building an extension with NumPy, one gets the path to the NumPy
includes using numpy.get_includes().  But of course, there's no way to
do this in setup.cfg.  Right now the only solution I can think of is
to add a setup_hook.

Anyways, worse comes to worse I'll build my extension modules in
setup.py only for now, but I'm just wondering if there's a decided
upon plan for extension modules in distutils2 yet.

Thanks,
Erik


More information about the Distutils-SIG mailing list