Commit edea6dcd authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 76365bce
......@@ -36,7 +36,8 @@ from collections import namedtuple
PkgInfo = namedtuple('PkgInfo', [
'name',
'version',
'kind'])
'kind',
'url'])
......@@ -44,8 +45,18 @@ PkgInfo = namedtuple('PkgInfo', [
def bom_software(installed_software_path): # -> {} name -> PkgInfo
bom = {}
def addbom(urlpath, kind):
name, ver = namever(urlpath) # XXX strip egg and py2.7-linux-x86_64
info = PkgInfo(name, ver, kind)
name, ver = namever(urlpath)
if '//' in urlpath:
url = urlpath
else:
if kind == 'egg':
# XXX not strictly correct -> better retrieve the actual URL, but buildout does not save it in installed.cfg
url = 'https://pypi.org/project/%s/%s/' % (name, ver)
else:
raise NotImplementedError('TODO url for kind %s' % kind)
info = PkgInfo(name, ver, kind, url)
if name in bom:
assert bom[name] == info, (bom[name], info)
else:
......@@ -207,7 +218,7 @@ def main():
elif what == 'node':
bom = bom_node(arg)
# print retrieved BOM
# print retrieved BOM grouped by kind
kinds = set()
for info in bom.values():
kinds.add(info.kind)
......@@ -218,7 +229,7 @@ def main():
for name in sorted(bom):
info = bom[name]
if info.kind == kind:
print('%-20s\t%s' % (name, info.version))
print('%-20s\t%s\t%s' % (name, info.version, info.url))
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment