Use defaultdict to generate the mapping
This commit is contained in:
parent
e34cde7aa5
commit
8de6168ae4
1 changed files with 5 additions and 10 deletions
|
@ -8,6 +8,7 @@ if len(sys.argv) != 2:
|
|||
|
||||
import os
|
||||
from os import path
|
||||
from collections import defaultdict
|
||||
from subprocess import Popen, PIPE
|
||||
from functools import cmp_to_key
|
||||
from datetime import datetime
|
||||
|
@ -44,19 +45,13 @@ def flatten(l):
|
|||
if l: yield l.pop(0)
|
||||
|
||||
# read mapping between Gentoo and Debian packages
|
||||
deb2gen = dict()
|
||||
gen2deb = dict()
|
||||
deb2gen = defaultdict(list)
|
||||
gen2deb = defaultdict(list)
|
||||
with open("./deb2gen_mapping.list") as f:
|
||||
for line in f:
|
||||
d, g = line.strip().split('\t')
|
||||
if deb2gen.get(d):
|
||||
deb2gen[d].append(g)
|
||||
else:
|
||||
deb2gen[d] = [g]
|
||||
if gen2deb.get(g):
|
||||
gen2deb[g].append(d)
|
||||
else:
|
||||
gen2deb[g] = [d]
|
||||
|
||||
with open("./deb_source_pkgs.list") as f:
|
||||
debian_names = [p[4:].strip() for p in f]
|
||||
|
|
Loading…
Reference in a new issue