Changeset 3a71759 in rtems-docs for common


Ignore:
Timestamp:
Jan 18, 2016, 5:05:50 AM (5 years ago)
Author:
Amar Takhar <amar@…>
Branches:
4.11, 5, am, master
Children:
11e1a6f
Parents:
46498bd
git-author:
Amar Takhar <amar@…> (01/18/16 05:05:50)
git-committer:
Amar Takhar <verm@…> (05/03/16 00:51:24)
Message:

Rework how conf.py is handled.

Needed to switch due to increasing complexity.

Location:
common
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • common/conf.py

    r46498bd r3a71759  
    1 import sys, os
    2 sys.path.append(os.path.abspath('.'))
    3 sys.path.append(os.path.abspath('../../common/'))
    4 
    5 @CONF_EXTRA@
     1#import sys, os
     2#sys.path.append(os.path.abspath('.'))
     3#sys.path.append(os.path.abspath('../../common/'))
     4
    65
    76extensions = [
     
    1716
    1817# Add any paths that contain templates here, relative to this directory.
    19 templates_path = ['_templates']
     18templates_path = ['build/_templates']
    2019
    2120# The suffix of source filenames.
     
    3029# General information about the project.
    3130project = u'RTEMS Documentation Project'
    32 copyright = u'2014, RTEMS Project'
     31copyright = u'2016, RTEMS Project'
    3332
    3433# The version info for the project you're documenting, acts as replacement for
     
    113112# relative to this directory. They are copied after the builtin static files,
    114113# so a file named "default.css" will overwrite the builtin "default.css".
    115 html_static_path = ['_static']
     114html_static_path = ['build/_static']
    116115
    117116# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
     
    163162
    164163# Output file base name for HTML help builder.
    165 htmlhelp_basename = 'rtemsuserdoc'
     164htmlhelp_basename = 'rtemsdoc'
    166165
    167166
  • common/waf.py

    r46498bd r3a71759  
    11import sys, os
     2
     3
    24
    35def cmd_configure(ctx):
    46        ctx.find_program("sphinx-build", var="SPHINX_BUILD")
    57
    6 def cmd_build(ctx, sub, source_dir="."):
     8def cmd_build(ctx, conf_dir=".", source_dir="."):
    79        srcnode = ctx.srcnode.abspath()
    8 
    9         file_conf = ctx.path.parent.find_node("common/conf.py")
    10         tg = ctx(
    11                 features    = "subst",
    12                 source      = file_conf,
    13                 target          = file_conf.name
    14         )
    15 
    16         tg.__dict__.update(sub)
    17 
    1810
    1911        # Copy resources.
     
    3022
    3123        ctx(
    32                 rule   = "${SPHINX_BUILD} -b html -c build -j %s -d build/doctrees %s build/html" % (ctx.options.jobs, source_dir),
     24                rule   = "${SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
    3325                cwd     = ctx.path.abspath(),
    34                 source =  ctx.path.ant_glob('**/*.rst') + ctx.path.ant_glob('conf.py'),
     26                source =  ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'),
    3527                target = ctx.path.find_or_declare('html/index.html')
    3628        )
    3729
     30def cmd_options_path(ctx):
     31        ctx.add_option('--rtems-path-py', type='string', help="Path to py/ in RTEMS.")
     32
     33
     34def cmd_configure_path(ctx):
     35        if not ctx.options.rtems_path_py:
     36                ctx.fatal("--rtems-path-py is required")
     37
     38        ctx.env.RTEMS_PATH = ctx.options.rtems_path_py
     39
     40        cmd_configure(ctx)
     41
     42
     43CONF_FRAG = """
     44sys.path.append(os.path.abspath('../../common/'))
     45sys.path.append('%s')
     46templates_path = ['_templates']
     47html_static_path = ['_static']
     48"""
     49
     50
     51# XXX: fix this ugly hack.  No time to waste on it.
     52def cmd_build_path(ctx):
     53        def run(task):
     54
     55                with open("conf.py") as fp:
     56                        conf = "import sys, os\nsys.path.append(os.path.abspath('../../common/'))\n"
     57                        conf += fp.read()
     58
     59                task.inputs[0].abspath()
     60                task.outputs[0].write(conf + (CONF_FRAG % ctx.env.RTEMS_PATH))
     61
     62        ctx(
     63                rule   = run,
     64                source = [ctx.path.parent.find_node("common/conf.py"), ctx.path.find_node("./conf.py")],
     65                target = ctx.path.get_bld().make_node('conf.py')
     66    )
     67
     68        cmd_build(ctx, conf_dir="build", source_dir="build")
Note: See TracChangeset for help on using the changeset viewer.