diff options
author | Jon Bernard <jbernard@tuxion.com> | 2016-01-16 22:22:39 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@tuxion.com> | 2016-01-17 06:48:44 -0500 |
commit | cf51dd817256cff106e170492ab678c7c1ab9d45 (patch) | |
tree | 1460c985b7a9db6e087e576a9fc1d5f5d45c985b | |
parent | 67e5e7432cf4a2bb9bd7148dc2976cfc30b6a06b (diff) | |
download | dotfiles-cf51dd817256cff106e170492ab678c7c1ab9d45.tar.gz dotfiles-cf51dd817256cff106e170492ab678c7c1ab9d45.tar.bz2 dotfiles-cf51dd817256cff106e170492ab678c7c1ab9d45.zip |
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.
-rw-r--r-- | dotfiles/repository.py | 4 |
1 files changed, 3 insertions, 1 deletions
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')) |