Skip to content

Commit

Permalink
merge alca and db cats
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Nov 26, 2024
1 parent c846de0 commit 46ed147
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions package2category.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def package2category(filename):
cat = "unknown"
if file_pack in pack2cat:
cat = "-".join(sorted(pack2cat[file_pack]))
if cat in ["alca", "db"]: cat="alca-db"
files[cat].add(filename)
cats[cat].add(file_pack)


Expand All @@ -27,6 +29,7 @@ def package2category(filename):
pack2cat[pack].append(cat)

cats = defaultdict(set)
files = defaultdict(set)

for line in args.files:
package2category(line.strip())
Expand All @@ -35,5 +38,21 @@ def package2category(filename):
for line in sys.stdin:
package2category(line.strip())

add_misc=False
if add_misc:
num = 1
misc = "misc%s" % num
misc_files=0
for cat in files:
if len(files[cat])<=5:
misc_files+=len(files[cat])
for pkg in cats[cat]:
cats[misc].add(pkg)
if misc_files>10:
num+=1
misc = "misc%s" % num
misc_files=0
del cats[cat]

for cat in cats:
print("%s %s" % (cat, " ".join(cats[cat])))

0 comments on commit 46ed147

Please sign in to comment.