setuptools bug: broken simlinks break setup()

In setuptools 0.6c5, a broken symlink in the package tree will cause 'setup develop' to fail, even in the file is inconsequential for the package. I think this is a bug. Here is the output of running "python setup.py develop" in a package called flydra with a broken symlink called broken.symlink: running develop running egg_info writing flydra.egg-info/PKG-INFO writing top-level names to flydra.egg-info/top_level.txt writing dependency_links to flydra.egg-info/dependency_links.txt writing entry points to flydra.egg-info/entry_points.txt error: broken.symlink: No such file or directory (I would try this using setuptools==dev, but it seems svn.python.org is down, or at least my connection to it.) -Andrew

At 12:23 PM 6/25/2007 -0700, Andrew Straw wrote:
In setuptools 0.6c5, a broken symlink in the package tree will cause 'setup develop' to fail, even in the file is inconsequential for the package. I think this is a bug.
Here is the output of running "python setup.py develop" in a package called flydra with a broken symlink called broken.symlink:
running develop running egg_info writing flydra.egg-info/PKG-INFO writing top-level names to flydra.egg-info/top_level.txt writing dependency_links to flydra.egg-info/dependency_links.txt writing entry points to flydra.egg-info/entry_points.txt error: broken.symlink: No such file or directory
(I would try this using setuptools==dev, but it seems svn.python.org is down, or at least my connection to it.)
Uh, where is this broken symlink exactly, and what does it point to? What is the contents of your setup.py? IOW, a minimal data set for reproducing the error would be helpful, as right now I don't have any idea where to begin looking for this.

OK, I attach a fairly minimal python package. It builds fine normally. Now, if you add a broken symlink in the source tree, it fails to build. For example, "ln -s /broken broken.symlink" in the same directory as setup.py. Phillip J. Eby wrote:
At 12:23 PM 6/25/2007 -0700, Andrew Straw wrote:
In setuptools 0.6c5, a broken symlink in the package tree will cause 'setup develop' to fail, even in the file is inconsequential for the package. I think this is a bug.
Here is the output of running "python setup.py develop" in a package called flydra with a broken symlink called broken.symlink:
running develop running egg_info writing flydra.egg-info/PKG-INFO writing top-level names to flydra.egg-info/top_level.txt writing dependency_links to flydra.egg-info/dependency_links.txt writing entry points to flydra.egg-info/entry_points.txt error: broken.symlink: No such file or directory
(I would try this using setuptools==dev, but it seems svn.python.org is down, or at least my connection to it.)
Uh, where is this broken symlink exactly, and what does it point to? What is the contents of your setup.py? IOW, a minimal data set for reproducing the error would be helpful, as right now I don't have any idea where to begin looking for this.

At 01:51 PM 6/25/2007 -0700, Andrew Straw wrote:
OK, I attach a fairly minimal python package. It builds fine normally. Now, if you add a broken symlink in the source tree, it fails to build. For example, "ln -s /broken broken.symlink" in the same directory as setup.py.
Tried it on Cygwin w/setuptools 0.6c6, nothing different happens with the symlink. What platform are you on?

I just tried it and saw the error as Andrew described. On 6/25/07, Andrew Straw <strawman@astraw.com> wrote:
Phillip J. Eby wrote:
What platform are you on?
Ubuntu GNU/Linux: both 6.10 x86_64 Python 2.4 as well as 7.04 i686 Python 2.5. _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig

This is an ongoing problem for me with emacs, which intentionally uses broken links to implement lock files. Arguably, this is emacs' fault, but I'd love to see a change to setuptools that made it ignore broken links. Jim On Jun 26, 2007, at 10:26 AM, Nathan R. Yergler wrote:
I just tried it and saw the error as Andrew described.
On 6/25/07, Andrew Straw <strawman@astraw.com> wrote:
Phillip J. Eby wrote:
What platform are you on?
Ubuntu GNU/Linux: both 6.10 x86_64 Python 2.4 as well as 7.04 i686 Python 2.5. _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
-- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org

At 10:43 AM 6/26/2007 -0400, Jim Fulton wrote:
This is an ongoing problem for me with emacs, which intentionally uses broken links to implement lock files. Arguably, this is emacs' fault, but I'd love to see a change to setuptools that made it ignore broken links.
Jim
Actually, as it turns out, it's distutils fault (well, the error is, anyway): $ DISTUTILS_DEBUG=y python2.3 setup.py develop ... Traceback (most recent call last): ... File "/usr/lib/python2.3/distutils/filelist.py", line 48, in findall self.allfiles = findall(dir) File "/usr/lib/python2.3/distutils/filelist.py", line 298, in findall stat = os.stat(fullname) OSError: [Errno 2] No such file or directory: 'broken.symlink' I'll add a workaround in setuptools, but somebody should fix the distutils, too. It looks like the 'findall()' function should be reimplemented with 'os.walk()'.

At 12:23 PM 6/25/2007 -0700, Andrew Straw wrote:
In setuptools 0.6c5, a broken symlink in the package tree will cause 'setup develop' to fail, even in the file is inconsequential for the package. I think this is a bug.
Here is the output of running "python setup.py develop" in a package called flydra with a broken symlink called broken.symlink:
running develop running egg_info writing flydra.egg-info/PKG-INFO writing top-level names to flydra.egg-info/top_level.txt writing dependency_links to flydra.egg-info/dependency_links.txt writing entry points to flydra.egg-info/entry_points.txt error: broken.symlink: No such file or directory
(I would try this using setuptools==dev, but it seems svn.python.org is down, or at least my connection to it.)
Okay, I've confirmed it's a distutils bug, and the following patch implements a workaround for it in setuptools. It'll be included in setuptools 0.6c7: Index: setuptools/__init__.py =================================================================== --- setuptools/__init__.py (revision 55712) +++ setuptools/__init__.py (working copy) @@ -65,18 +65,17 @@ +def findall(dir = os.curdir): + """Find all files under 'dir' and return the list of full filenames + (relative to 'dir'). + """ + all_files = [] + for base, dirs, files in os.walk(dir): + if base!=os.curdir: + files = [os.path.join(base, f) for f in files] + all_files.extend(filter(os.path.isfile, files)) + return all_files +import distutils.filelist +distutils.filelist.findall = findall # fix findall bug in distutils. - - - - - - - - - - - - -
participants (4)
-
Andrew Straw
-
Jim Fulton
-
Nathan R. Yergler
-
Phillip J. Eby