Permalink
Browse files

Merge pull request #23 from jbraeuer/master

Follow symlinks, when requested, drop recursion detection.
  • Loading branch information...
2 parents fc4f740 + 22c60c1 commit add5f2bc840c47bafef1c2faaf8470e889300a52 @mludvig mludvig committed Feb 22, 2012
Showing with 2 additions and 8 deletions.
  1. +2 −8 S3/FileLists.py
View
@@ -24,18 +24,12 @@ def _fswalk_follow_symlinks(path):
If a recursive directory link is detected, emit a warning and skip.
'''
assert os.path.isdir(path) # only designed for directory argument
- walkdirs = set([path])
- targets = set()
+ walkdirs = [path]
for dirpath, dirnames, filenames in os.walk(path):
for dirname in dirnames:
current = os.path.join(dirpath, dirname)
- target = os.path.realpath(current)
if os.path.islink(current):
- if target in targets:
- warning("Skipping recursively symlinked directory %s" % dirname)
- else:
- walkdirs.add(current)
- targets.add(target)
+ walkdirs.append(current)
for walkdir in walkdirs:
for value in os.walk(walkdir):
yield value

0 comments on commit add5f2b

Please sign in to comment.