Fix libraries being sorted alphabetically by full path rather than just library name

This commit is contained in:
Kovid Goyal 2017-08-20 22:44:39 +05:30
parent f90de5d9d7
commit 331190c369
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -79,7 +79,7 @@ class LibraryUsageStats(object): # {{{
if lpath in locs: if lpath in locs:
locs.remove(lpath) locs.remove(lpath)
limit = tweaks['many_libraries'] if limit is None else limit limit = tweaks['many_libraries'] if limit is None else limit
key = sort_key if len(locs) > limit else lambda x:self.stats[x] key = (lambda x:sort_key(os.path.basename(x))) if len(locs) > limit else self.stats.get
locs.sort(key=key, reverse=len(locs)<=limit) locs.sort(key=key, reverse=len(locs)<=limit)
for loc in locs: for loc in locs:
yield self.pretty(loc), loc yield self.pretty(loc), loc