+ def _check_traversed_dir_links(self, root, dirs):
+ """
+ Remove from the 'dirs' list the already traversed directory symlinks,
+ register the new dir symlinks as traversed.
+ """
+ for d in [d for d in dirs if os.path.isdir(os.path.join(root, d)) and
+ os.path.islink(os.path.join(root, d))]:
+ real_dirpath = os.path.realpath(os.path.join(root, d))
+ if real_dirpath in self._traversed_links:
+ dirs.remove(d)
+ self.logger.warning("Skipping '{}' symlink to directory '{}' because it was already uploaded".format(os.path.join(root, d), real_dirpath))
+ else:
+ self._traversed_links.add(real_dirpath)
+ return dirs
+