[Distutils] Distutils 2.6.2 changes will break setuptools

P.J. Eby pje at telecommunity.com
Sun Feb 22 05:13:46 CET 2009


At 04:50 AM 2/22/2009 +0100, Tarek Ziadé wrote:
>On Sun, Feb 22, 2009 at 4:30 AM, P.J. Eby <pje at telecommunity.com> wrote:
> > At 11:55 PM 2/21/2009 +0100, Tarek Ziadé wrote:
> >>
> >> Hi Phillip,
> >>
> >> Some changes in distutils/sdist are breaking some commands in
> >> setuptools' egg_info because of a getattr that make a recursive error,
> >>
> >> I think it could be a great thing to fix it as soon as possible before
> >> Python 2.6.1 is out,
>
>Typo : before the first version of 2.7 is out
>
>Notice that standalone releases of Distutils are planned soon, including a
>development snapshots, so it should be easier to test the latest changes.
>
> >>
> >> I am available if you need more info on this
> >
> > At a bare minimum, the Python SVN revision numbers and the resulting
> > traceback would be helpful.  A bug filed to the setuptools tracker would
> > probably also be a good idea, so that I'm not the only person who can look
> > at it or provide a fix...  either for setuptools or the stdlib, as
> > appropriate.
> >
>
>Sure,
>
>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"
>
>http://svn.python.org/view/python/trunk/Lib/distutils/command/sdist.py?r1=68951&r2=69692

I'm not sure this problem is fixable on the setuptools side -- the 
calculation was made lazy specifically to *avoid* this problem!  That 
is, I intentionally prevented Python 2.4+ distutils from calculating 
the data files during option finalization, because the data files 
can't be correctly known until *after* the manifest is built.

I have no idea what to do about this -- on either setuptools or 
distutils.  For setuptools, file list calculation is inherently 
circular - an existing manifest is always reused and pruned, in order 
to support situations where a revctrl-based file list is then used in 
a scenario without revision control.  (That is, the MANIFEST included 
with a shipped sdist is used as a backup for identifying files that 
might originally have been found via a revctrl finder.)



More information about the Distutils-SIG mailing list