"type": "object",
"properties": {
"name": {"type": "string"},
- "description": { "type": "string" },
- "maintainer": { "type": "string" },
+ "description": {"type": "string"},
+ "maintainer": {"type": "string"},
"state": {"type": "string",
"enum": ["production", "experimental"]},
- "features": { "$ref": "#/definitions/features" },
- "missing": { "$ref": "#/definitions/features" },
- "properties": { "type": "array",
- "items": { "type": "string",
- "enum": ["API", "CLI", "STATS", "MULTITHREAD"] },
+ "features": {"$ref": "#/definitions/features"},
+ "missing": {"$ref": "#/definitions/features"},
+ "properties": {"type": "array",
+ "items": {"type": "string",
+ "enum": ["API", "CLI", "STATS",
+ "MULTITHREAD"]},
},
},
"additionalProperties": False,
"featureobject": {
"type": "object",
"patternProperties": {
- "^.*$": { "$ref": "#/definitions/features" },
+ "^.*$": {"$ref": "#/definitions/features"},
},
},
"features": {
"type": "array",
- "items": {"anyOf": [{ "$ref": "#/definitions/featureobject" },
- { "type": "string" },
- ]},
+ "items": {"anyOf": [{"$ref": "#/definitions/featureobject"},
+ {"type": "string"},
+ ]},
"minItems": 1,
},
},
}
-
def filelist_from_git_status():
filelist = []
git_status = 'git status --porcelain */FEATURE.yaml'
filelist.append(l.split()[1])
return filelist
+
def filelist_from_git_ls():
filelist = []
git_ls = 'git ls-files :(top)*/FEATURE.yaml'
filelist.append(l)
return filelist
+
def output_features(indent, fl):
for f in fl:
if type(f) is dict:
- for k,v in f.items():
+ for k, v in f.items():
print('{}- {}'.format(' ' * indent, k))
output_features(indent + 2, v)
else:
print('{}- {}'.format(' ' * indent, f))
+
def output_markdown(features):
- for k,v in features.items():
+ for k, v in features.items():
print('# {}'.format(v['name']))
print('Maintainer: {} '.format(v['maintainer']))
print('State: {}\n'.format(v['state']))
output_features(0, v['missing'])
print()
+
def main():
parser = argparse.ArgumentParser(description='VPP Feature List.')
parser.add_argument('--validate', dest='validate', action='store_true',
# Load configuration file
with open(featurefile) as f:
- cfg = yaml.load(f)
+ cfg = yaml.load(f, Loader=yaml.SafeLoader)
validate(instance=cfg, schema=schema)
features[featurefile] = cfg
if args.markdown:
output_markdown(features)
+
if __name__ == '__main__':
main()