Support for removing of symlinks
Bug #144228 reported by
Radim Novotny
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Buildout |
New
|
Undecided
|
Unassigned |
Bug Description
_uninstall method of the Buildout class does not support removing of symbolic links pointing to directory.
I'm writing recipe which creates symbolic links to other locations and this recipe fails on reinstall. _uninstall method should be changed to:
(first check if f is file or link and then check if f is directory. Symlink pointing to directory is treated as directory)
def _uninstall(self, installed):
for f in installed.
if not f:
f = self._buildout_
if os.path.isfile(f) or os.path.islink(f):
elif os.path.isdir(f):
To post a comment you must log in.
To rephrase Radim, symbolic links pointing to directories are not properly removed by buildout. This is because in _uninstall, removed filesystem items are first checked for whether they are directories. An os.path.isdir(link) check for a link pointing to a directory returns True, similarly to check on a link pointing to a file returns True for an isfile(link) check.
Buildout checks first for whether the filesystem item to be removed returns True for isdir(). This is wrong, because buildout then tries to rmtree(link), which causes havoc.
Instead, in _uninstall, the check for file & link should be first.The issue can thus simply be fixed by reversing the checks.