interop/organize.py
Chris Hoge f68840ea1c Updated 2015.next.json to use new capabilities
The capabilities classifications were updated to have a more
defined breakdown of the capabilities. This patch takes all of
the existing tests in the 2015.05.next file and reclassifies
them. No tests were added or removed. Patch includes scripts
and supporting files for review, updating, and collaboration.

Also added auth-token as required for compute.

Please review if auth-token should be required for object.

Remove temp files before merging.

Work in progress

Change-Id: Ie3a77c443f30327606ba62832cb6bea2d3ada14e
2015-07-15 17:46:33 -07:00

60 lines
2.0 KiB
Python

import json
defcore = json.loads(open('2015.next.json','r').read())
new_caps = json.loads(open('newcaps.json','r').read())
capabilities = {}
old_capabilities = defcore["capabilities"]
for old_capability in old_capabilities:
old_capability = old_capabilities[old_capability]
achievements = old_capability["achievements"]
admin = old_capability["admin"]
try:
required_since = old_capability["required-since"]
except:
required_since = ""
description = old_capability["description"]
name = old_capability["name"]
try:
project = old_capability["project"]
except:
project = "TODO"
tests = old_capability["tests"]
for test in tests:
try:
flag = old_capability["tests"][test]["flag"]
except:
flag = None
new_capability_name = new_caps[test]["capability"]
try:
capability = capabilities[new_capability_name]
except:
capability = {}
capability["achievements"] = set()
capability["admin"] = set()
capability["required-since"] = set()
capability["description"] = set()
capability["project"] = set()
capability["tests"] = {}
for achievement in achievements:
capability["achievements"].add(achievement)
capability["admin"].add(str(admin))
capability["required-since"].add(required_since)
capability["description"].add(description)
capability["project"].add(project)
capability["tests"][test] = tests[test]
capabilities[new_capability_name] = capability
for capability in capabilities:
cap = capabilities[capability]
cap["achievements"] = list(cap["achievements"])
cap["admin"] = ", ".join(cap["admin"])
cap["required-since"] = ", ".join(cap["required-since"])
cap["description"] = ", ".join(cap["description"])
cap["project"] = ", ".join(cap["project"])
print json.dumps(capabilities, sort_keys=True, indent=2, separators=(',', ': '))