[Distutils] Mutual recursion between setuptools and distutils with Python 2.7

Tarek Ziadé ziade.tarek at gmail.com
Mon Jun 1 00:08:59 CEST 2009

Hello Antoine,

Yes, I have already mentioned the problem to Phillip a few months ago
(in February). Setuptools no longer works with Distutils trunk.

it happens because setuptools build_py implementation has a
__getattr__ that computes data_file:

  def __getattr__(self,attr):
        if attr=='data_files':  # lazily compute data files
            self.data_files = files = self._get_data_files(); return files
        return _build_py.__getattr__(self,attr)

But Distutils sdist command loops over build_py.data_files to add them
in the MANIFEST file,
because this attribute should be computed by finalize_command.

And this is done when sdist.add_default is called, so it loops
recursively and dies

see "for pkg, src_dir, build_dir, filenames in build_py.data_files: in"


I think Setuptools needs to change its strategy when it builds the
file lists to include. Probably by splitting
the work in two distinct phases and remove the getattr hack.

Now the major problem with this is : the last setuptools commit is 7
months old, and right now
people are trying to obtain a new setuptools version for svn 1.6
compatiblity for quite a time now.

So I fear that setuptools might end up broken when 2.7 and 3.1 is out.

I can try to help on that, but I need two things from Phillip:

1/ what he wants to do on setuptools side to fix that problem
2/ blessing me to do it,  and do a release with that change + the
patches that are waiting for some time,
     that he is OK to add.


Tarek Ziadé | http://ziade.org

More information about the Distutils-SIG mailing list