Release 0.8.0: Windows installer, twelve fixes from a real Server 2019 install, operator docs
This commit is contained in:
@@ -20,6 +20,21 @@ OUT = os.path.join(REPO, 'docs', 'openapi.json')
|
||||
VERBS = ('get', 'post', 'put', 'patch', 'delete', 'head', 'options')
|
||||
|
||||
|
||||
def _product_version():
|
||||
"""Read __version__ out of shopdb/__init__.py without importing the app.
|
||||
|
||||
Importing shopdb here would pull in Flask, the plugin loader and a database
|
||||
configuration, none of which this generator needs.
|
||||
"""
|
||||
here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
init = os.path.join(here, 'shopdb', '__init__.py')
|
||||
with open(init, 'r', encoding='utf-8') as handle:
|
||||
match = re.search(r"^__version__ = '([^']+)'", handle.read(), re.M)
|
||||
if not match:
|
||||
raise SystemExit('could not read __version__ from ' + init)
|
||||
return match.group(1)
|
||||
|
||||
|
||||
def _norm_path(p):
|
||||
# Flask <int:id> / <id> -> OpenAPI {id}
|
||||
return re.sub(r'<(?:[^:>]+:)?([^>]+)>', r'{\1}', p or '')
|
||||
@@ -68,7 +83,10 @@ def build(surfaces):
|
||||
'openapi': '3.1.0',
|
||||
'info': {
|
||||
'title': 'ShopDB Flask API',
|
||||
'version': '0.7.0',
|
||||
# Read from the code, not restated. A hardcoded copy here had
|
||||
# already drifted a release behind, and the same mistake in the
|
||||
# installer script shipped an exe stamped with the wrong version.
|
||||
'version': _product_version(),
|
||||
'description': (
|
||||
'Asset-management API (core + plugins). Responses use a '
|
||||
'`success_response` envelope: `{status, data, meta}`. Auth: Bearer '
|
||||
|
||||
Reference in New Issue
Block a user