mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-09 11:03:00 +00:00
set version as long as we are rewriting the file
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
- run: |
|
- run: |
|
||||||
pip install -r docs/requirements.txt pytest
|
pip install -r docs/requirements.txt pytest -e .
|
||||||
- run: |
|
- run: |
|
||||||
pytest docs/
|
pytest docs/
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ from pathlib import Path
|
|||||||
from pytablewriter import MarkdownTableWriter
|
from pytablewriter import MarkdownTableWriter
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
import jupyterhub
|
||||||
from jupyterhub.scopes import scope_definitions
|
from jupyterhub.scopes import scope_definitions
|
||||||
|
|
||||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||||
@@ -102,9 +103,10 @@ class ScopeTableGenerator:
|
|||||||
yaml = YAML(typ='rt')
|
yaml = YAML(typ='rt')
|
||||||
yaml.preserve_quotes = True
|
yaml.preserve_quotes = True
|
||||||
scope_dict = {}
|
scope_dict = {}
|
||||||
with open(filename, 'r+') as f:
|
with open(filename) as f:
|
||||||
content = yaml.load(f.read())
|
content = yaml.load(f.read())
|
||||||
f.seek(0)
|
|
||||||
|
content["info"]["version"] = jupyterhub.__version__
|
||||||
for scope in self.scopes:
|
for scope in self.scopes:
|
||||||
description = self.scopes[scope]['description']
|
description = self.scopes[scope]['description']
|
||||||
doc_description = self.scopes[scope].get('doc_description', '')
|
doc_description = self.scopes[scope].get('doc_description', '')
|
||||||
@@ -112,8 +114,9 @@ class ScopeTableGenerator:
|
|||||||
description = doc_description
|
description = doc_description
|
||||||
scope_dict[scope] = description
|
scope_dict[scope] = description
|
||||||
content['securityDefinitions']['oauth2']['scopes'] = scope_dict
|
content['securityDefinitions']['oauth2']['scopes'] = scope_dict
|
||||||
|
|
||||||
|
with open(filename, 'w') as f:
|
||||||
yaml.dump(content, f)
|
yaml.dump(content, f)
|
||||||
f.truncate()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Reference in New Issue
Block a user