Rework how conf.py is handled.

Needed to switch due to increasing complexity.
This commit is contained in:
Amar Takhar 2016-01-18 00:05:50 -05:00 committed by Amar Takhar
parent 46498bd4e3
commit 3a717592a9
29 changed files with 167 additions and 159 deletions

8
ada_user/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
book/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
bsp_howto/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

View File

@ -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)

0
common/__init__.py Normal file
View File

View File

@ -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 --------------------------------------------------

View File

@ -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")

8
cpu_supplement/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
develenv/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
filesystem/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
networking/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
porting/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
posix1003_1/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
posix_users/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)

8
rtemsconfig/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)
cmd_build_path(ctx)
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(ctx, sub)

View File

@ -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)

8
user/conf.py Normal file
View File

@ -0,0 +1,8 @@
import sys, os
sys.path.append(os.path.abspath('../common/'))
from conf import *
version = '1.0'
release = '5.0'

View File

@ -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)