From 1da5483baa502d9a0cd41a70e0926a2d3bab5bb5 Mon Sep 17 00:00:00 2001 From: Hampapur Ajay Date: Wed, 9 Nov 2016 15:52:38 -0800 Subject: [PATCH] Pick up version to be included in documentation from right path. Also bundle it so it can be accessed at :8082/documentation/_static/contrail_openapi.json Change-Id: I6cba6b5eeb3337b9a1f0a9040f8fd336512ce4bf Partial-Bug: 1621664 (cherry picked from commit f4243d23b6d356d46cc66aa17dd201e2a2046f20) --- src/config/api-server/doc/SConscript | 4 +++- src/config/api-server/doc/source/conf.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config/api-server/doc/SConscript b/src/config/api-server/doc/SConscript index 166e8051ca3..46428865cef 100644 --- a/src/config/api-server/doc/SConscript +++ b/src/config/api-server/doc/SConscript @@ -20,10 +20,12 @@ if os.path.exists('/usr/bin/sphinx-apidoc'): userdoc_rule = env.Install(Dir('.'), Glob('#controller/src/config/api-server/doc/source/*')) schema_rule = env.Install(Dir('.'), Glob('#controller/src/schema/*.xsd')) gendoc_rule = env.Install(Dir('.'), env['TOP'] + '/config/api-server/vnc_cfg_api_server/gen/contrail_openapi.rst') + openapi_rule = env.Install(Dir('.'), env['TOP'] + '/config/api-server/vnc_cfg_api_server/gen/contrail_openapi.json') html_gen_rule = env.Command('contrail-config', ['Makefile', 'conf.py'], 'make -C ' + Dir('.').path + ' html') - env.Depends(html_gen_rule, [apidoc_rule, gendoc_rule, userdoc_rule, schema_rule]) + env.Depends(html_gen_rule, + [apidoc_rule, gendoc_rule, userdoc_rule, schema_rule, openapi_rule]) doc_sources_rules.append(env.Install("../vnc_cfg_api_server", Dir('.'))) diff --git a/src/config/api-server/doc/source/conf.py b/src/config/api-server/doc/source/conf.py index 0168fe8d65c..432bd11feba 100644 --- a/src/config/api-server/doc/source/conf.py +++ b/src/config/api-server/doc/source/conf.py @@ -55,8 +55,8 @@ # The short X.Y version. data = '0.99' try: - with open ("../../../../../src/base/version.info", "r") as myfile: - data=myfile.read().replace('\n', '') + with open("../../../../../controller/src/base/version.info", "r") as f: + data=f.read().replace('\n', '') except: pass @@ -132,7 +132,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ['_static', 'contrail_openapi.json'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format.