From 3a717592a9d13f7668c7fd3f9638adcc197d873d Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Mon, 18 Jan 2016 00:05:50 -0500 Subject: Rework how conf.py is handled. Needed to switch due to increasing complexity. --- ada_user/conf.py | 8 +++++++ ada_user/wscript | 10 +-------- book/conf.py | 8 +++++++ book/wscript | 13 ++++-------- bsp_howto/conf.py | 8 +++++++ bsp_howto/wscript | 10 +-------- c_user/wscript | 10 +-------- common/__init__.py | 0 common/conf.py | 15 +++++++------ common/waf.py | 57 ++++++++++++++++++++++++++++++++++++++------------ cpu_supplement/conf.py | 8 +++++++ cpu_supplement/wscript | 10 +-------- develenv/conf.py | 8 +++++++ develenv/wscript | 10 +-------- filesystem/conf.py | 8 +++++++ filesystem/wscript | 10 +-------- networking/conf.py | 8 +++++++ networking/wscript | 10 +-------- porting/conf.py | 8 +++++++ porting/wscript | 10 +-------- posix1003_1/conf.py | 8 +++++++ posix1003_1/wscript | 10 +-------- posix_users/conf.py | 8 +++++++ posix_users/wscript | 10 +-------- rtemsconfig/conf.py | 8 +++++++ rtemsconfig/wscript | 25 ++++------------------ shell/wscript | 10 +-------- user/conf.py | 8 +++++++ user/wscript | 10 +-------- 29 files changed, 167 insertions(+), 159 deletions(-) create mode 100644 ada_user/conf.py create mode 100644 book/conf.py create mode 100644 bsp_howto/conf.py create mode 100644 common/__init__.py create mode 100644 cpu_supplement/conf.py create mode 100644 develenv/conf.py create mode 100644 filesystem/conf.py create mode 100644 networking/conf.py create mode 100644 porting/conf.py create mode 100644 posix1003_1/conf.py create mode 100644 posix_users/conf.py create mode 100644 rtemsconfig/conf.py create mode 100644 user/conf.py diff --git a/ada_user/conf.py b/ada_user/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/ada_user/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/ada_user/wscript b/ada_user/wscript index c6bdfe8..0956726 100644 --- a/ada_user/wscript +++ b/ada_user/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "ADA User", - "FILE_DOC": "rtemsada_user", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/book/conf.py b/book/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/book/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/book/wscript b/book/wscript index cc7e438..bcd9860 100644 --- a/book/wscript +++ b/book/wscript @@ -2,21 +2,16 @@ from sys import path from os.path import abspath, exists path.append(abspath('../common/')) -from waf import cmd_configure, cmd_build +from waf import cmd_configure_path, cmd_build_path, cmd_options_path def options(ctx): - ctx.add_option('--rtems-path-py', type='string', help="Path to py/ in RTEMS.") + cmd_options_path(ctx) def configure(ctx): - if not ctx.options.rtems_path_py: - ctx.fatal("--rtems-path-py is required") - - ctx.env.RTEMS_PATH = ctx.options.rtems_path_py - cmd_configure(ctx) + cmd_configure_path(ctx) def build(ctx): - dirs = [ "user", "rtemsconfig", @@ -69,4 +64,4 @@ def build(ctx): "CONF_EXTRA": "sys.path.append('%s')" % ctx.env.RTEMS_PATH } - cmd_build(ctx, sub, source_dir="build") + cmd_build_path(ctx) diff --git a/bsp_howto/conf.py b/bsp_howto/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/bsp_howto/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/bsp_howto/wscript b/bsp_howto/wscript index 16f000e..0956726 100644 --- a/bsp_howto/wscript +++ b/bsp_howto/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "BSP Howto", - "FILE_DOC": "rtemsbsp_howto", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/c_user/wscript b/c_user/wscript index 32658eb..0956726 100644 --- a/c_user/wscript +++ b/c_user/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "C User", - "FILE_DOC": "rtemsc_user", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/common/__init__.py b/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/conf.py b/common/conf.py index 027a29f..f50c259 100644 --- a/common/conf.py +++ b/common/conf.py @@ -1,8 +1,7 @@ -import sys, os -sys.path.append(os.path.abspath('.')) -sys.path.append(os.path.abspath('../../common/')) +#import sys, os +#sys.path.append(os.path.abspath('.')) +#sys.path.append(os.path.abspath('../../common/')) -@CONF_EXTRA@ extensions = [ "sphinx.ext.autodoc", @@ -16,7 +15,7 @@ extensions = [ ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ['build/_templates'] # The suffix of source filenames. source_suffix = '.rst' @@ -29,7 +28,7 @@ master_doc = 'index' # General information about the project. project = u'RTEMS Documentation Project' -copyright = u'2014, RTEMS Project' +copyright = u'2016, RTEMS Project' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -112,7 +111,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # 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 = ['build/_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -162,7 +161,7 @@ html_sidebars = { #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'rtemsuserdoc' +htmlhelp_basename = 'rtemsdoc' # -- Options for LaTeX output -------------------------------------------------- diff --git a/common/waf.py b/common/waf.py index bd5243a..5437ab3 100644 --- a/common/waf.py +++ b/common/waf.py @@ -1,21 +1,13 @@ import sys, os + + def cmd_configure(ctx): ctx.find_program("sphinx-build", var="SPHINX_BUILD") -def cmd_build(ctx, sub, source_dir="."): +def cmd_build(ctx, conf_dir=".", source_dir="."): srcnode = ctx.srcnode.abspath() - file_conf = ctx.path.parent.find_node("common/conf.py") - tg = ctx( - features = "subst", - source = file_conf, - target = file_conf.name - ) - - tg.__dict__.update(sub) - - # Copy resources. for dir in ["_static", "_templates"]: files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir) @@ -29,9 +21,48 @@ def cmd_build(ctx, sub, source_dir="."): ) ctx( - rule = "${SPHINX_BUILD} -b html -c build -j %s -d build/doctrees %s build/html" % (ctx.options.jobs, source_dir), + rule = "${SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir), cwd = ctx.path.abspath(), - source = ctx.path.ant_glob('**/*.rst') + ctx.path.ant_glob('conf.py'), + source = ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'), target = ctx.path.find_or_declare('html/index.html') ) +def cmd_options_path(ctx): + ctx.add_option('--rtems-path-py', type='string', help="Path to py/ in RTEMS.") + + +def cmd_configure_path(ctx): + if not ctx.options.rtems_path_py: + ctx.fatal("--rtems-path-py is required") + + ctx.env.RTEMS_PATH = ctx.options.rtems_path_py + + cmd_configure(ctx) + + +CONF_FRAG = """ +sys.path.append(os.path.abspath('../../common/')) +sys.path.append('%s') +templates_path = ['_templates'] +html_static_path = ['_static'] +""" + + +# XXX: fix this ugly hack. No time to waste on it. +def cmd_build_path(ctx): + def run(task): + + with open("conf.py") as fp: + conf = "import sys, os\nsys.path.append(os.path.abspath('../../common/'))\n" + conf += fp.read() + + task.inputs[0].abspath() + task.outputs[0].write(conf + (CONF_FRAG % ctx.env.RTEMS_PATH)) + + ctx( + rule = run, + source = [ctx.path.parent.find_node("common/conf.py"), ctx.path.find_node("./conf.py")], + target = ctx.path.get_bld().make_node('conf.py') + ) + + cmd_build(ctx, conf_dir="build", source_dir="build") diff --git a/cpu_supplement/conf.py b/cpu_supplement/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/cpu_supplement/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/cpu_supplement/wscript b/cpu_supplement/wscript index 906be46..0956726 100644 --- a/cpu_supplement/wscript +++ b/cpu_supplement/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "CPU Supplement", - "FILE_DOC": "rtemcpu_supplement", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/develenv/conf.py b/develenv/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/develenv/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/develenv/wscript b/develenv/wscript index b42a1d3..0956726 100644 --- a/develenv/wscript +++ b/develenv/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "Development Environment", - "FILE_DOC": "rtemsdevelenv", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/filesystem/conf.py b/filesystem/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/filesystem/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/filesystem/wscript b/filesystem/wscript index 9c0048e..0956726 100644 --- a/filesystem/wscript +++ b/filesystem/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "Filesystem", - "FILE_DOC": "rtemsfilesystem", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/networking/conf.py b/networking/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/networking/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/networking/wscript b/networking/wscript index 7524c18..0956726 100644 --- a/networking/wscript +++ b/networking/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "Networking", - "FILE_DOC": "rtemsnetworking", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/porting/conf.py b/porting/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/porting/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/porting/wscript b/porting/wscript index ab2b188..0956726 100644 --- a/porting/wscript +++ b/porting/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "POSIX", - "FILE_DOC": "rtemsposix", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/posix1003_1/conf.py b/posix1003_1/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/posix1003_1/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/posix1003_1/wscript b/posix1003_1/wscript index 33fe573..0956726 100644 --- a/posix1003_1/wscript +++ b/posix1003_1/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "POSIX 1003_1", - "FILE_DOC": "rtemsposix1003_1", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/posix_users/conf.py b/posix_users/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/posix_users/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/posix_users/wscript b/posix_users/wscript index 5fbd7fa..0956726 100644 --- a/posix_users/wscript +++ b/posix_users/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "POSIX Users", - "FILE_DOC": "rtemsposix_users", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/rtemsconfig/conf.py b/rtemsconfig/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/rtemsconfig/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/rtemsconfig/wscript b/rtemsconfig/wscript index a681104..7d9e282 100644 --- a/rtemsconfig/wscript +++ b/rtemsconfig/wscript @@ -2,32 +2,15 @@ from sys import path from os.path import abspath path.append(abspath('../common/')) +from waf import cmd_options_path, cmd_configure_path, cmd_build_path -from waf import cmd_configure, cmd_build def options(ctx): - ctx.add_option('--rtems-path-py', type='string', help="Path to py/ in RTEMS.") + cmd_options_path(ctx) def configure(ctx): - - if not ctx.options.rtems_path_py: - ctx.fatal("--rtems-path-py is required") - - ctx.env.RTEMS_PATH = ctx.options.rtems_path_py - - cmd_configure(ctx) - - + cmd_configure_path(ctx) def build(ctx): -# path.append(ctx.env.RTEMS_PATH) - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "RTEMS Config", - "FILE_DOC": "rtemsconfig", - "CONF_EXTRA": "sys.path.append('%s')" % ctx.env.RTEMS_PATH - } + cmd_build_path(ctx) - cmd_build(ctx, sub) diff --git a/shell/wscript b/shell/wscript index 939f4cf..0956726 100644 --- a/shell/wscript +++ b/shell/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "Shell", - "FILE_DOC": "rtemsshell", - } - - cmd_build(ctx, sub) + cmd_build(ctx) diff --git a/user/conf.py b/user/conf.py new file mode 100644 index 0000000..5e042a7 --- /dev/null +++ b/user/conf.py @@ -0,0 +1,8 @@ +import sys, os +sys.path.append(os.path.abspath('../common/')) + +from conf import * + +version = '1.0' +release = '5.0' + diff --git a/user/wscript b/user/wscript index 7f76341..0956726 100644 --- a/user/wscript +++ b/user/wscript @@ -8,12 +8,4 @@ def configure(ctx): cmd_configure(ctx) def build(ctx): - - sub = { - "VERSION": "1.0", - "RELEASE": "5.0.0", - "DOC": "User Manual", - "FILE_DOC": "rtemsmanual", - } - - cmd_build(ctx, sub) + cmd_build(ctx) -- cgit v1.2.3