Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the code run on python3. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
print('<?xml version="1.0" encoding="UTF-8" ?>')
#print '<testsuites tests="{0}" failures="{0}" > '.format(num_cves)
print('<testsuite id="CVE TEST" name="CVE TEST" tests="{0}" failures="{1}">'.format(num_cves, num_failed_cves))
for package_name, info in cves.iteritems():
for package_name, info in cves.items():

for e in info:
print('<testcase id="{0}" name="{0}" classname="{1}" time="0">'.format(e['@name'], package_name))
Expand Down
12 changes: 6 additions & 6 deletions cve_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def etree_to_dict(t):
if children:
dd = defaultdict(list)
for dc in map(etree_to_dict, children):
for k, v in dc.iteritems():
for k, v in dc.items():
dd[k].append(v)
d = {t.tag: {k:v[0] if len(v) == 1 else v for k, v in dd.iteritems()}}
d = {t.tag: {k:v[0] if len(v) == 1 else v for k, v in dd.items()}}
if t.attrib:
d[t.tag].update(('@' + k, v) for k, v in t.attrib.iteritems())
d[t.tag].update(('@' + k, v) for k, v in t.attrib.items())
if t.text:
text = t.text.strip()
if children or t.attrib:
Expand Down Expand Up @@ -128,7 +128,7 @@ def get_packages_ls(package_list):
name = name[3:]
packages[name].add(version)

print name, version
print(name, version)
# print "\t".join([path, name, verrel, version, release, platform])
else:
errors.append('ERROR: Invalid name: %s\n' % x)
Expand Down Expand Up @@ -187,10 +187,10 @@ def add_package(name, version):

add_package(name, version)
except Exception as e:
print e
print(e)
errors.append('ERROR: Invalid line: %s\n' % line)

print packages
print(packages)
return errors, packages


Expand Down