summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/__init__.py0
-rw-r--r--common/conf.py15
-rw-r--r--common/waf.py57
3 files changed, 51 insertions, 21 deletions
diff --git a/common/__init__.py b/common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/__init__.py
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")