From 075149bb1c92e3dc5df9fd07feebe60a3c8e4fef Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 7 Dec 2021 23:02:43 +0000 Subject: fixed issues with getting most popular package --- src/verbs/sync.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/verbs/sync.py') diff --git a/src/verbs/sync.py b/src/verbs/sync.py index 38a8a39..07ed2ec 100644 --- a/src/verbs/sync.py +++ b/src/verbs/sync.py @@ -47,7 +47,16 @@ def validate_package(package, versions, repo, verbose=False): popularity[checksum] = 0 popularity[checksum] += 1 - most_popular = sorted(popularity)[-1] + most_popular = "" + p_count = -1 + for p,c in popularity.items(): + if c > p_count: + most_popular = p + p_count = c + + if verbose: + ##print(package, ":", popularity) + print(most_popular) sources = [v[1] for v in versions if v[0] == most_popular] # change the packages dict to list all the sources -- cgit v1.2.1