summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDan Klein <danklei@cisco.com>2015-10-26 08:21:11 +0200
committerDan Klein <danklei@cisco.com>2015-10-26 08:21:11 +0200
commit5c04563aae8893c4e55c8a6e494d961ea8410215 (patch)
treef383732ec1855e024ccde58fe104eb1325515c8b /wscript
parent4f20acd25e9b818919858df5b8c7a2a1527caa9a (diff)
Updates to ws scripts- add build_cp_docs rule in more robust way
Diffstat (limited to 'wscript')
-rwxr-xr-xwscript41
1 files changed, 28 insertions, 13 deletions
diff --git a/wscript b/wscript
index 3302ec58..31b5c9c1 100755
--- a/wscript
+++ b/wscript
@@ -87,6 +87,7 @@ def options(opt):
def configure(conf):
conf.find_program('asciidoc', path='/usr/local/bin/', var='ASCIIDOC')
+ conf.find_program('sphinx-build', path_list='/usr/local/bin/', var='SPHINX')
pass;
def convert_to_pdf(task):
@@ -119,17 +120,22 @@ def do_visio(bld):
for x in bld.path.ant_glob('visio\\*.vsd'):
tg = bld(rule='${VIS} -i ${SRC} -o ${TGT} ', source=x, target=x.change_ext('.png'))
-def build_cp_docs (trex_src_dir, dest_dir = "_build", builder = "html"):
- build_doc_cmd = shlex.split("/usr/local/bin/sphinx-build -b {bld} {src} {dst}".format(
- bld= builder,
- src= ".",
- dst= dest_dir)
+#def build_cp_docs (trex_src_dir, dest_dir = "_build", builder = "html"):
+def build_cp_docs (task):
+ out_dir = task.outputs[0].abspath()
+ export_path = os.path.join(os.getcwd(), 'build', 'cp_docs')
+ trex_core_git_path = os.path.join(os.getcwd(), os.pardir, "trex-core")
+ if not os.path.isdir(trex_core_git_path):
+ trex_core_git_path = os.getenv('TREX_CORE_GIT', None)
+ if trex_core_git_path: # there exists a default directory or the desired ENV variable.
+ trex_core_docs_path = os.path.abspath(os.path.join(trex_core_git_path, 'scripts', 'automation', 'trex_control_plane', 'doc'))
+ build_doc_cmd = shlex.split("/usr/local/bin/sphinx-build -W -b {bld} {src} {dst}".format(
+ bld= "html",
+ src= ".",
+ dst= out_dir)
)
- bld_path = os.path.abspath( os.path.join(trex_src_dir, 'scripts', 'automation', 'trex_control_plane', 'doc') )
- ret_val = subprocess.call(build_doc_cmd, cwd = bld_path)
- if ret_val:
- raise RuntimeError("Build operation of control plain docs failed with return value {ret}".format(ret= ret_val))
- return
+ return subprocess.call(build_doc_cmd, cwd = trex_core_docs_path)
+ return (1)
def build(bld):
@@ -203,11 +209,20 @@ def build(bld):
bld(rule='${ASCIIDOC} -a stylesheet=${SRC[1].abspath()} -a icons=true -a toc2 -a max-width=55em -o ${TGT} ${SRC[0].abspath()}',
source='trex_control_plane_peek.asciidoc waf.css', target='trex_control_plane_peek.html', scan=ascii_doc_scan)
+# bld(rule=build_cp_docs,
+# source='1.txt', target='cp_docs', scan=ascii_doc_scan)
+
# generate control plane documentation
export_path = os.path.join(os.getcwd(), 'build', 'cp_docs')
- trex_core_git_path = os.getenv('TREX_CORE_GIT', None)
- if trex_core_git_path: # there exists the desired ENV variable.
- build_cp_docs(trex_core_git_path, dest_dir= export_path)
+ trex_core_git_path = os.path.join(os.getcwd(), os.pardir, "trex-core")
+ if not os.path.isdir(trex_core_git_path):
+ trex_core_git_path = os.getenv('TREX_CORE_GIT', None)
+ if trex_core_git_path: # there exists a default directory or the desired ENV variable.
+ trex_core_docs_path = os.path.join(trex_core_git_path, 'scripts', 'automation', 'trex_control_plane', 'doc', 'index.rst')
+ bld(rule=build_cp_docs,
+# source = '1.txt',#trex_core_docs_path,
+ target = 'cp_docs')
+ # build_cp_docs(trex_core_git_path, dest_dir= export_path)
else:
raise NameError("Environment variable 'TREX_CORE_GIT' is not defined.")