set version as long as we are rewriting the file

This commit is contained in:
Min RK
2021-10-27 22:18:56 +02:00
parent 21d08883a8
commit 5c01370e6f
2 changed files with 14 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ from pathlib import Path
from pytablewriter import MarkdownTableWriter
from ruamel.yaml import YAML
import jupyterhub
from jupyterhub.scopes import scope_definitions
HERE = os.path.abspath(os.path.dirname(__file__))
@@ -102,18 +103,20 @@ class ScopeTableGenerator:
yaml = YAML(typ='rt')
yaml.preserve_quotes = True
scope_dict = {}
with open(filename, 'r+') as f:
with open(filename) as f:
content = yaml.load(f.read())
f.seek(0)
for scope in self.scopes:
description = self.scopes[scope]['description']
doc_description = self.scopes[scope].get('doc_description', '')
if doc_description:
description = doc_description
scope_dict[scope] = description
content['securityDefinitions']['oauth2']['scopes'] = scope_dict
content["info"]["version"] = jupyterhub.__version__
for scope in self.scopes:
description = self.scopes[scope]['description']
doc_description = self.scopes[scope].get('doc_description', '')
if doc_description:
description = doc_description
scope_dict[scope] = description
content['securityDefinitions']['oauth2']['scopes'] = scope_dict
with open(filename, 'w') as f:
yaml.dump(content, f)
f.truncate()
def main():