[Distutils] setuptools bug: broken simlinks break setup()

Phillip J. Eby pje at telecommunity.com
Thu Jun 28 20:06:24 CEST 2007

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.


More information about the Distutils-SIG mailing list