Esempio n. 1
0
def image_jobs(conf=None):
    conf = lazy_conf(None)
    paths = conf.paths

    meta_file = os.path.join(paths.images, 'metadata') + '.yaml'

    if not os.path.exists(meta_file):
        raise StopIteration

    images_meta = ingest_yaml_list(meta_file)

    if images_meta is None:
        raise StopIteration

    for image in images_meta:
        image['dir'] = paths.images
        source_base = os.path.join(image['dir'], image['name'])
        source_file = dot_concat(source_base, 'svg')
        rst_file = dot_concat(source_base, 'rst')
        image['conf'] = conf

        yield {
            'target':
            rst_file,
            'dependency': [
                meta_file,
                os.path.join(paths.buildsystem, 'utils', 'rstcloth',
                             'images.py')
            ],
            'job':
            generate_image_pages,
            'args':
            image
        }

        for output in image['output']:
            if 'tag' in output:
                tag = '-' + output['tag']
            else:
                tag = ''

            target_img = source_base + tag + '.png'

            inkscape_cmd = '{cmd} -z -d {dpi} -w {width} -y 0.0 -e >/dev/null {target} {source}'

            yield {
                'target':
                target_img,
                'dependency': [source_file, meta_file],
                'job':
                _generate_images,
                'args': [
                    inkscape_cmd, output['dpi'], output['width'], target_img,
                    source_file
                ],
            }
Esempio n. 2
0
def image_jobs(conf=None):
    conf = lazy_conf(None)
    paths = conf.paths

    meta_file = os.path.join(paths.images, 'metadata') + '.yaml'

    if not os.path.exists(meta_file):
        raise StopIteration

    images_meta = ingest_yaml_list(meta_file)

    if images_meta is None:
        raise StopIteration

    for image in images_meta:
        image['dir'] = paths.images
        source_base = os.path.join(image['dir'], image['name'])
        source_file = dot_concat(source_base, 'svg')
        rst_file = dot_concat(source_base, 'rst')
        image['conf'] = conf

        yield {
                'target': rst_file,
                'dependency': [ meta_file, os.path.join(paths.buildsystem, 'utils', 'rstcloth', 'images.py') ],
                'job': generate_image_pages,
                'args': image,
                'description': "generating rst include file {0} for {1}".format(rst_file, source_file)
              }

        for output in image['output']:
            if 'tag' in output:
                tag = '-' + output['tag']
            else:
                tag = ''

            target_img = source_base + tag + '.png'

            inkscape_cmd = '{cmd} -z -d {dpi} -w {width} -y 0.0 -e >/dev/null {target} {source}'

            yield {
                    'target': target_img,
                    'dependency': [ source_file, meta_file ],
                    'job': _generate_images,
                    'args': [
                              inkscape_cmd,
                              output['dpi'],
                              output['width'],
                              target_img,
                              source_file
                            ],
                    'description': 'generating image file {0} from {1}'.format(target_img, source_file)
                  }
Esempio n. 3
0
def json_output_jobs(conf):

    regexes = [
        (re.compile(r'<a class=\"headerlink\"'), '<a'),
        (re.compile(r'<[^>]*>'), ''),
        (re.compile(r'&#8220;'), '"'),
        (re.compile(r'&#8221;'), '"'),
        (re.compile(r'&#8216;'), "'"),
        (re.compile(r'&#8217;'), "'"),
        (re.compile(r'&#\d{4};'), ''),
        (re.compile(r'&nbsp;'), ''),
        (re.compile(r'&gt;'), '>'),
        (re.compile(r'&lt;'), '<')
    ]

    outputs = []
    for fn in expand_tree('source', 'txt'):
        # path = build/<branch>/json/<filename>

        path = os.path.join(conf.paths.branch_output,
                            'json', os.path.splitext(fn.split(os.path.sep, 1)[1])[0])
        fjson = dot_concat(path, 'fjson')
        json = dot_concat(path, 'json')

        if conf.project.name == 'mms':
            if not os.path.exists(fjson):
                continue

        yield { 'target': json,
                'dependency': fjson,
                'job': process_json_file,
                'description': "processing json file".format(json),
                'args': (fjson, json, regexes, conf) }

        outputs.append(json)

    list_file = os.path.join(conf.paths.branch_output, 'json-file-list')

    yield { 'target': list_file,
            'dependency': None,
            'description': 'generating json index list {0}'.format(list_file),
            'job': generate_list_file,
            'args': (outputs, list_file, conf) }

    json_output(conf)
Esempio n. 4
0
def json_output_jobs(conf):

    regexes = [(re.compile(r'<a class=\"headerlink\"'), '<a'),
               (re.compile(r'<[^>]*>'), ''), (re.compile(r'&#8220;'), '"'),
               (re.compile(r'&#8221;'), '"'), (re.compile(r'&#8216;'), "'"),
               (re.compile(r'&#8217;'), "'"), (re.compile(r'&#\d{4};'), ''),
               (re.compile(r'&nbsp;'), ''), (re.compile(r'&gt;'), '>'),
               (re.compile(r'&lt;'), '<')]

    outputs = []
    for fn in expand_tree('source', 'txt'):
        # path = build/<branch>/json/<filename>

        path = os.path.join(conf.paths.branch_output, 'json',
                            os.path.splitext(fn.split(os.path.sep, 1)[1])[0])
        fjson = dot_concat(path, 'fjson')
        json = dot_concat(path, 'json')

        if conf.project.name == 'mms':
            if not os.path.exists(fjson):
                continue

        yield {
            'target': json,
            'dependency': fjson,
            'job': process_json_file,
            'description': "processing json file".format(json),
            'args': (fjson, json, regexes, conf)
        }

        outputs.append(json)

    list_file = os.path.join(conf.paths.branch_output, 'json-file-list')

    yield {
        'target': list_file,
        'dependency': None,
        'description': 'generating json index list {0}'.format(list_file),
        'job': generate_list_file,
        'args': (outputs, list_file, conf)
    }

    json_output(conf)
Esempio n. 5
0
def json_output_jobs(conf=None):
    conf = lazy_conf(conf)

    regexes = [
        (re.compile(r'<a class=\"headerlink\"'), '<a'),
        (re.compile(r'<[^>]*>'), ''),
        (re.compile(r'&#8220;'), '"'),
        (re.compile(r'&#8221;'), '"'),
        (re.compile(r'&#8216;'), "'"),
        (re.compile(r'&#8217;'), "'"),
        (re.compile(r'&#\d{4};'), ''),
        (re.compile(r'&nbsp;'), ''),
        (re.compile(r'&gt;'), '>'),
        (re.compile(r'&lt;'), '<')
    ]

    outputs = []
    for fn in expand_tree('source', 'txt'):
        # path = build/<branch>/json/<filename>

        path = os.path.join(conf.paths.branch_output,
                            'json', os.path.splitext(fn.split(os.path.sep, 1)[1])[0])
        fjson = dot_concat(path, 'fjson')
        json = dot_concat(path, 'json')

        if conf.project.name == 'mms':
            if not os.path.exists(fjson):
                continue

        yield dict(target=json,
                   dependency=fjson,
                   job=process_json_file,
                   args=(fjson, json, regexes, conf))

        outputs.append(json)

    list_file = os.path.join(conf.paths.branch_staging, 'json-file-list')

    yield dict(target=list_file,
               dependency=None,
               job=generate_list_file,
               args=(outputs, list_file, conf))
Esempio n. 6
0
def api_jobs(conf=None):
    conf = lazy_conf(conf)

    for source in expand_tree(os.path.join(conf.paths.projectroot, conf.paths.source, 'reference'), 'yaml'):
        target = dot_concat(os.path.splitext(source)[0], 'rst')

        yield {
                'target': target,
                'dependency': source,
                'job': _generate_api_param,
                'args': [source, target, conf]
              }
Esempio n. 7
0
def json_output_jobs(conf=None):
    conf = lazy_conf(conf)

    regexes = [(re.compile(r'<a class=\"headerlink\"'), '<a'),
               (re.compile(r'<[^>]*>'), ''), (re.compile(r'&#8220;'), '"'),
               (re.compile(r'&#8221;'), '"'), (re.compile(r'&#8216;'), "'"),
               (re.compile(r'&#8217;'), "'"), (re.compile(r'&#\d{4};'), ''),
               (re.compile(r'&nbsp;'), ''), (re.compile(r'&gt;'), '>'),
               (re.compile(r'&lt;'), '<')]

    outputs = []
    for fn in expand_tree('source', 'txt'):
        # path = build/<branch>/json/<filename>

        path = os.path.join(conf.paths.branch_output, 'json',
                            os.path.splitext(fn.split(os.path.sep, 1)[1])[0])
        fjson = dot_concat(path, 'fjson')
        json = dot_concat(path, 'json')

        if conf.project.name == 'mms':
            if not os.path.exists(fjson):
                continue

        yield dict(target=json,
                   dependency=fjson,
                   job=process_json_file,
                   args=(fjson, json, regexes, conf))

        outputs.append(json)

    list_file = os.path.join(conf.paths.branch_staging, 'json-file-list')

    yield dict(target=list_file,
               dependency=None,
               job=generate_list_file,
               args=(outputs, list_file, conf))
Esempio n. 8
0
html_copy_source = False
html_use_smartypants = True
html_domain_indices = True
html_use_index = True
html_split_index = False
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True

manual_edition_path = '{0}/{1}/{2}'.format(conf.project.url,
                                           conf.git.branches.current,
                                           sconf.theme.book_path_base)

html_theme_options = {
    'branch': conf.git.branches.current,
    'pdfpath': dot_concat(manual_edition_path, 'pdf'),
    'epubpath': dot_concat(manual_edition_path, 'epub'),
    'manual_path': get_manual_path(conf),
    'translations': languages,
    'language': language,
    'repo_name': sconf.theme.repo,
    'jira_project': sconf.theme.jira,
    'google_analytics': sconf.theme.google_analytics,
    'project': sconf.theme.project,
    'version': version,
    'version_selector': get_versions(conf),
    'stable': conf.version.stable,
    'sitename': sconf.theme.sitename,
    'nav_excluded': sconf.theme.nav_excluded,
}
Esempio n. 9
0
File: conf.py Progetto: nopjorn/docs
html_static_path = sconf.paths.static

html_copy_source = False
html_use_smartypants = True
html_domain_indices = True
html_use_index = True
html_split_index = False
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True

manual_edition_path = "{0}/{1}/{2}".format(conf.project.url, conf.git.branches.current, sconf.theme.book_path_base)

html_theme_options = {
    "branch": conf.git.branches.current,
    "pdfpath": dot_concat(manual_edition_path, "pdf"),
    "epubpath": dot_concat(manual_edition_path, "epub"),
    "manual_path": get_manual_path(conf),
    "translations": languages,
    "language": language,
    "repo_name": sconf.theme.repo,
    "jira_project": sconf.theme.jira,
    "google_analytics": sconf.theme.google_analytics,
    "project": sconf.theme.project,
    "version": version,
    "version_selector": get_versions(conf),
    "stable": conf.version.stable,
    "sitename": sconf.theme.sitename,
    "nav_excluded": sconf.theme.nav_excluded,
}
Esempio n. 10
0
html_copy_source = False
html_use_smartypants = True
html_domain_indices = True
html_use_index = True
html_split_index = False
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True

manual_edition_path = '{0}/{1}/{2}'.format(conf.project.url,
                                           conf.git.branches.current,
                                           sconf.theme.book_path_base)

html_theme_options = {
    'branch': conf.git.branches.current,
    'pdfpath': dot_concat(manual_edition_path, 'pdf'),
    'epubpath': dot_concat(manual_edition_path, 'epub'),
    'manual_path': get_manual_path(conf),
    'translations': languages,
    'language': language,
    'repo_name': sconf.theme.repo,
    'jira_project': sconf.theme.jira,
    'google_analytics': sconf.theme.google_analytics,
    'project': sconf.theme.project,
    'version': version,
    'version_selector': get_versions(conf),
    'stable': conf.version.stable,
    'sitename': sconf.theme.sitename,
    'nav_excluded': sconf.theme.nav_excluded,
}
Esempio n. 11
0
def _get_table_output_name(fn):
    base, leaf = os.path.split(os.path.splitext(fn)[0])

    return dot_concat(os.path.join(base, 'table', leaf[6:]), 'rst')