diff --git a/tools/repostats.py b/tools/repostats.py
index 0cd69005..e4bd9d33 100755
--- a/tools/repostats.py
+++ b/tools/repostats.py
@@ -32,58 +32,31 @@ def valuesort(x, y):
return 1
-class Max:
- def __init__(self, title, count):
- self.list = {}
- self.title = title
- self.count = count
-
- def add(self, name, value):
- list = {}
- i = 0
- for x,y in self.list.items():
- if value > y:
- list[name] = value
- else:
- list[x] = y
- i += 1
- if i >= self.count:
- break
- if i < self.count:
- list[name] = value
- self.list = list
-
- def get_list(self):
- items = self.list.items()
- items.sort(valuesort)
- return items
-
- def html_out(self):
- echo(("
%s
" % self.title) % self.count)
- for x,y in self.get_list():
- echo("| %s | %s |
" % (x, y))
- echo("
")
-
-
class Histogram:
def __init__(self, title):
self.list = {}
self.title = title
- def add(self, name):
- if self.list.has_key(name):
- self.list[name] = self.list[name] + 1
+ def add(self, name, value=None):
+ if value:
+ self.list[name] = value
else:
- self.list[name] = 1
+ if self.list.has_key(name):
+ self.list[name] = self.list[name] + 1
+ else:
+ self.list[name] = 1
def get_list(self):
items = self.list.items()
items.sort(valuesort)
return items
- def html_out(self):
+ def html_out(self, max=0):
echo("%s
" % self.title)
- for name,cnt in self.get_list():
+ list = self.get_list()
+ if max != 0:
+ list = list[:max]
+ for name,cnt in list:
echo("| %s | %s |
" % (name, cnt))
echo("
")
@@ -120,8 +93,8 @@ components = Histogram(_("Components"))
dependencies = Histogram(_("Dependencies"))
releases = Histogram(_("Releases"))
types = Histogram(_("File types"))
-mostpatched = Max(_("Top %d most patched source"), 5)
-longpy = Max(_("Top %d longest action.py scripts"), 5)
+mostpatched = Histogram(_("Top five most patched source"))
+longpy = Histogram(_("Top five longest action.py scripts"))
nr_binpaks = 0
nr_patches = 0
paknames = {}
@@ -171,8 +144,8 @@ echo("")
print "Toplam %d kod paketi, ve bunlardan oluşturulacak %d ikili paket var.
" % (len(paks), nr_binpaks)
echo(u"Toplam peç sayısı %d
" % nr_patches)
-mostpatched.html_out()
-longpy.html_out()
+mostpatched.html_out(5)
+longpy.html_out(5)
if errors != []:
print "Hatalar
"
@@ -192,13 +165,17 @@ types.html_out()
echo(_("Dependencies
"))
echo(_("package name with italics are not available in the repository
"))
print ""
+notavail = 0
for name,cnt in dependencies.get_list():
if paknames.has_key(name):
print "| %s | %d |
" % (name, cnt)
else:
+ notavail += 1
print "| %s | %d |
" % (name, cnt)
print "
"
+print "%d packages are not available in repository.
" % notavail
+
hosts.html_out()
print ""