Changeset 1a051fc in rtems-docs


Ignore:
Timestamp:
Feb 20, 2019, 4:40:37 AM (4 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
2e6f49f
Parents:
62efd4c
git-author:
Chris Johns <chrisj@…> (02/20/19 04:40:37)
git-committer:
Chris Johns <chrisj@…> (02/27/19 23:22:54)
Message:

waf: Add support for extra and excluded sources.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • common/waf.py

    r62efd4c r1a051fc  
    158158
    159159def html_resources(ctx, buildtype):
    160     extra_source = []
     160    resources = []
    161161    for dir_name in ["_static", "_templates"]:
    162162        files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir_name)
    163163        fnode = ctx.path.get_bld().make_node(os.path.join(buildtype, dir_name))
    164164        targets = [fnode.make_node(x.name) for x in files]
    165         extra_source += targets
     165        resources += targets
    166166        fnode.mkdir() # dirs
    167167        ctx(features = "subst",
     
    170170            target   = targets)
    171171        ctx.add_group()
    172     return extra_source
     172    return resources
    173173
    174174def check_sphinx_extension(ctx, extension):
     
    299299                ctx.fatal("DITAA not found, plase install")
    300300
    301 def doc_pdf(ctx, source_dir, conf_dir, extra_source):
     301def sources_exclude(ctx, sources):
     302    exclude = sources.get('exclude', [])
     303    if len(exclude) == 0:
     304        return exclude
     305    return [ctx.path.find_node(e) for e in exclude]
     306
     307def sources_extra(ctx, sources):
     308    extra = sources.get('extra', [])
     309    if len(extra) == 0:
     310        extra = [ctx.path.find_node(e) for e in extra]
     311    return [e for e in extra if e not in sources_exclude(ctx, sources)]
     312
     313def sources_source(ctx, sources):
     314    extra = sources_extra(ctx, sources)
     315    exclude = sources_exclude(ctx, sources)
     316    source = ctx.path.ant_glob('**/*.rst')
     317    return [s for s in source if s not in exclude] + extra
     318
     319def doc_pdf(ctx, source_dir, conf_dir, sources):
    302320    buildtype = 'latex'
    303321    build_dir, output_node, output_dir, doctrees = build_dir_setup(ctx, buildtype)
     
    307325        rule         = rule,
    308326        cwd          = ctx.path,
    309         source       = ctx.path.ant_glob('**/*.rst') + extra_source,
    310         depends_on   = extra_source,
     327        source       = sources_source(ctx, sources),
     328        depends_on   = sources_extra(sources),
    311329        target       = ctx.path.find_or_declare("%s/%s.tex" % (buildtype,
    312330                                                               ctx.path.name))
     
    324342                      quiet = True)
    325343
    326 def doc_singlehtml(ctx, source_dir, conf_dir, extra_source):
     344def doc_singlehtml(ctx, source_dir, conf_dir, sources):
    327345    #
    328346    # Use a run command to handle stdout and stderr output from inliner. Using
     
    358376        rule         = rule,
    359377        cwd          = ctx.path,
    360         source       = ctx.path.ant_glob('**/*.rst') + extra_source,
     378        source       = sources_source(ctx, sources),
    361379        depends_on   = resources,
    362380        target       = ctx.path.find_or_declare("%s/index.html" % (buildtype)),
     
    371389    )
    372390
    373 def doc_html(ctx, source_dir, conf_dir, extra_source):
     391def doc_html(ctx, source_dir, conf_dir, sources):
    374392    buildtype = 'html'
    375393    build_dir, output_node, output_dir, doctrees = build_dir_setup(ctx, buildtype)
     
    381399        rule         = rule,
    382400        cwd          = ctx.path,
    383         source       = ctx.path.ant_glob('**/*.rst') + extra_source,
     401        source       = sources_source(ctx, sources),
    384402        depends_on   = resources,
    385403        target       = ctx.path.find_or_declare('%s/index.html' % buildtype),
     
    415433        )
    416434
    417 def cmd_build(ctx, extra_source = []):
     435def cmd_build(ctx, sources = {}):
    418436    conf_dir = ctx.path.get_src()
    419437    source_dir = ctx.path.get_src()
    420438
    421439    if ctx.env.BUILD_PDF == 'yes':
    422         doc_pdf(ctx, source_dir, conf_dir, extra_source)
     440        doc_pdf(ctx, source_dir, conf_dir, sources)
    423441
    424442    if ctx.env.BUILD_SINGLEHTML == 'yes':
    425         doc_singlehtml(ctx, source_dir, conf_dir, extra_source)
    426 
    427     doc_html(ctx, source_dir, conf_dir, extra_source)
     443        doc_singlehtml(ctx, source_dir, conf_dir, sources)
     444
     445    doc_html(ctx, source_dir, conf_dir, sources)
    428446
    429447def cmd_build_images(ctx):
  • posix-compliance/wscript

    r62efd4c r1a051fc  
    2727        source = ['posix_rst.py', 'RTEMS-Standards-Compliance-v4a.csv'],
    2828        target = 'generated-posix-compliance.rst')
    29     doc_build(ctx, extra_source = ['generated-posix-compliance.rst'])
     29    sources = { 'extra' : ['generated-posix-compliance.rst'] }
     30    doc_build(ctx, sources = sources)
Note: See TracChangeset for help on using the changeset viewer.