Issue 21318: sdist fails with symbolic links do non-existing files (original) (raw)
If there is a symbolic link to a non-existing file anywhere in the source tree "python setup.py sdist" fails with an output like the following:
running sdist
running check
warning: check: missing required meta-data: url
error: abc: No such file or directory
Pruning the problematic path with a MANIFEST.in file does not help.
I could locate the culprit in filelist.py <http://hg.python.org/cpython/file/c82dcad83438/Lib/distutils/filelist.py> in line 267:
stat = os.stat(fullname)
fails for symlinks to non-existing files. Maybe os.lstat should be used? Or it should be checked before os.stat if it is a symlink to a nonexisting file?
In case you wonder why I have links to non-existing files in my source tree: Those can be left behind by automated tests I'm using and are not supposed to be part of the source (or any other) distribution. But as I said, the error is not prevented by excluding them with a MANIFEST.in file. My current workaround is to delete all the leftovers from the test as first thing in setup.py.