diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-11-01 02:34:32 -0400 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-11-05 20:47:18 +0000 |
commit | ea1a65135e01311e31e94b8d0ed0721c9856775d (patch) | |
tree | acd57fd15fe4d441bb31a7dde878ce3290687cf5 /src/scripts/fts.py | |
parent | 5854b43de4c04a7c52b0cf03cd548c9cac86c325 (diff) |
docs: fix issues with src/scripts/fts.py
- packaging issue
- yaml deprecation
- yaml formatting
Type: fix
Change-Id: Ia8808cbc83271a3067164f2db2418f071b35607a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/scripts/fts.py')
-rwxr-xr-x | src/scripts/fts.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/scripts/fts.py b/src/scripts/fts.py index 6d224ddffe4..eb44be9a59a 100755 --- a/src/scripts/fts.py +++ b/src/scripts/fts.py @@ -16,15 +16,16 @@ schema = { "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, @@ -32,21 +33,20 @@ schema = { "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' @@ -59,6 +59,7 @@ def filelist_from_git_status(): filelist.append(l.split()[1]) return filelist + def filelist_from_git_ls(): filelist = [] git_ls = 'git ls-files :(top)*/FEATURE.yaml' @@ -71,17 +72,19 @@ def filelist_from_git_ls(): 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'])) @@ -92,6 +95,7 @@ def output_markdown(features): output_features(0, v['missing']) print() + def main(): parser = argparse.ArgumentParser(description='VPP Feature List.') parser.add_argument('--validate', dest='validate', action='store_true', @@ -120,12 +124,13 @@ def main(): # 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() |