From cf51dd817256cff106e170492ab678c7c1ab9d45 Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Sat, 16 Jan 2016 22:22:39 -0500 Subject: Sort contents on our own py.path.local.visit() sorting doesn't seem to work, at least not in a way that makes sense to me. --- dotfiles/repository.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dotfiles/repository.py b/dotfiles/repository.py index 63fab23..fef77e9 100644 --- a/dotfiles/repository.py +++ b/dotfiles/repository.py @@ -1,5 +1,6 @@ import py from click import echo +from operator import attrgetter from .dotfile import Dotfile from .exceptions import DotfileException, TargetIgnored, IsDirectory, \ @@ -92,4 +93,5 @@ class Repository(object): def construct(target): return Dotfile(self._target_to_name(target), target) - return map(construct, self.repodir.visit(filter, recurse, sort=True)) + contents = self.repodir.visit(filter, recurse) + return sorted(map(construct, contents), key=attrgetter('name')) -- cgit v1.2.3