예제 #1
0
def main():
    input_data = utils.ingest_yaml_list(sys.argv[1])
    generate_params(input_data)

    r.write(sys.argv[2])

    print('[api]: rebuilt "' + sys.argv[2] + '" parameter table.')
예제 #2
0
def main():
    conf_file = utils.get_conf_file(__file__)
    make_all_links(utils.ingest_yaml_list(conf_file))

    m.write(sys.argv[1])

    print('[meta-build]: built "' + sys.argv[1] + '" to specify symlink builders.')
예제 #3
0
def main():
    parser = argparse.ArgumentParser('image generator')
    parser.add_argument('output',
                        action='store',
                        default='build/makefile.images',
                        help='config file name.')
    parser.add_argument('dir',
                        action='store',
                        default='source/images',
                        help='path to images directory.')
    parser.add_argument('config',
                        action='store',
                        default='metadata.yaml',
                        help='config file name.')
    ui = parser.parse_args()

    conf = '/'.join([ui.dir, ui.config])

    images = utils.ingest_yaml_list(conf)
    for image in images:
        image['dir'] = ui.dir

    generate_targets(images)

    m.write(ui.output)

    print('[meta-build]: built "' + sys.argv[1] + '" to specify images.')
예제 #4
0
파일: param.py 프로젝트: ajem70/docs
def main():
    input_data = utils.ingest_yaml_list(sys.argv[1])
    generate_params(input_data)

    r.write(sys.argv[2])

    print('[api]: rebuilt "' + sys.argv[2] + '" parameter table.')
예제 #5
0
def main():
    conf_file = utils.get_conf_file(__file__)
    build_all_pdfs(utils.ingest_yaml_list(conf_file))

    m.target("pdfs", utils.expand_tree(os.path.join(paths["branch-output"], "latex"), "tex"))

    m.write(sys.argv[1])
    print('[meta-build]: built "' + sys.argv[1] + '" to specify pdf builders.')
예제 #6
0
def main():
    conf_file = utils.get_conf_file(__file__)
    make_all_links(utils.ingest_yaml_list(conf_file))

    m.write(sys.argv[1])

    print('[meta-build]: built "' + sys.argv[1] +
          '" to specify symlink builders.')
예제 #7
0
def main():
    conf_file = utils.get_conf_file(__file__)
    build_all_pdfs(utils.ingest_yaml_list(conf_file))

    m.target(
        'pdfs',
        utils.expand_tree(os.path.join(paths['branch-output'], 'latex'),
                          'tex'))

    m.write(sys.argv[1])
    print('[meta-build]: built "' + sys.argv[1] + '" to specify pdf builders.')
예제 #8
0
def populate_external_param(fn, basename, projectdir, sourcedir):
    if fn.startswith('/'):
        fn = os.path.join(sourcedir, fn[1:])

    try:
        ext_param = utils.ingest_yaml_list(fn)
    except OSError:
        fn = os.path.join(basename, fn)
        ext_param = utils.ingest_yaml_list(fn)
    except OSError:
        fn = os.path.join(projectdir, sourcedir, fn)
        ext_param = utils.ingest_yaml_list(fn)
    else:
        pass

    o = { }
    for param in ext_param:
        # leaving the object sub-document unmodified if we use it at some point,
        # we might need to modify here.
        o[param['name']] = param

    return fn, o
예제 #9
0
def image_jobs():
    conf = get_conf()
    paths = conf.build.paths

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

    if not os.path.exists(meta_file):
        return

    images_meta = ingest_yaml_list(meta_file)

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

        yield {
                'target': rst_file,
                'dependency': [ meta_file, os.path.join(paths.buildsystem, '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,
                    'job': _generate_images,
                    'args': [
                              inkscape_cmd,
                              output['dpi'],
                              output['width'],
                              target_img,
                              source_file
                            ],
                  }
예제 #10
0
def error_pages():
    conf = get_conf()

    error_conf = os.path.join(conf.build.paths.builddata, 'errors.yaml')

    if not os.path.exists(error_conf):
        return None
    else:
        error_pages = ingest_yaml_list(error_conf)

        sub = (re.compile(r'\.\./\.\./'), conf.project.url + r'/' + conf.project.tag + r'/')

        for error in error_pages:
            page = os.path.join(conf.build.paths.projectroot, conf.build.paths['branch-output'], 'dirhtml', 'meta', error, 'index.html')
            munge_page(fn=page, regex=sub, tag='error-pages')

        puts('[error-pages]: rendered {0} error pages'.format(len(error_pages)))
예제 #11
0
def main():
    parser = argparse.ArgumentParser('image generator')
    parser.add_argument('output', action='store', default='build/makefile.images', help='config file name.')
    parser.add_argument('dir', action='store', default='source/images', help='path to images directory.')
    parser.add_argument('config', action='store', default='metadata.yaml', help='config file name.')
    ui = parser.parse_args()

    conf = '/'.join([ui.dir, ui.config])

    images = ingest_yaml_list(conf)
    for image in images:
        image['dir'] = ui.dir

    generate_targets(images)

    m.write(ui.output)

    print('[meta-build]: built "' + sys.argv[1] + '" to specify images.')
예제 #12
0
    def __init__(self, fn, cache=None):
        if cache is None:
            cache = dict()

        self.source_fn = fn
        self.agg_sources = cache
        self.source_list = ingest_yaml_list(self.source_fn)
        self.source = dict()

        sort_needed = False

        idx = 0
        for step in self.source_list:
            if 'stepnum' not in step:
                step['stepnum'] = idx+1
            else:
                sort_needed = True

            if 'source' in step:
                if 'action' in step:
                    raise InvalidStep
                source_file = step['source']['file']
                if source_file in self.agg_sources:
                    current_step = self.agg_sources[step['source']['file']][step['source']['ref']]
                else:
                    steps = Steps(source_file, self.agg_sources)
                    current_step = steps.get_step(step['source']['ref'])
                    self.agg_sources[source_file] = steps
                    self.agg_sources.update(steps.agg_sources)

                current_step.update(step)

                self.source_list[idx] = current_step
                self.source[step['source']['ref']] = current_step
            else:
                self.source[step['ref']] = step

            idx += 1

        if sort_needed is True:
            self.source_list.sort(key=lambda k:k['stepnum'])
예제 #13
0
def intersphinx_jobs():
    conf = get_conf()
    data_file = os.path.join(conf.build.paths.projectroot,
                             conf.build.paths.builddata,
                             'intersphinx.yaml')

    if not os.path.exists(data_file):
        return

    intersphinx_mapping = ingest_yaml_list(data_file)

    for i in intersphinx_mapping:
        f = os.path.join(conf.build.paths.projectroot,
                         conf.build.paths.output, i['path'])

        s = i['url'] + 'objects.inv'

        yield {
                'target': f,
                'dependency': None,
                'job': download,
                'args': { 'f': f, 's': s }
              }
예제 #14
0
def htaccess(fn='.htaccess'):
    conf = load_conf()

    if env.input_file is None:
        in_files = [i for i in expand_tree(conf.build.paths.builddata, 'yaml') if os.path.basename(i).startswith('htaccess')]
    else:
        in_files = list(env.input_file)

    sources = []
    for i in in_files:
        sources.extend(ingest_yaml_list(i))

    dirname = os.path.dirname(fn)
    if not dirname == '' and not os.path.exists(dirname):
        os.makedirs(dirname)

    lines = set()
    for redir in sources:
        lines.add(generate_redirects(process_redirect(redir, conf), conf=conf, match=False))

    with open(fn, 'w') as f:
        f.writelines(lines)

    puts('[redirect]: regenerated {0} with {1} redirects ({2} lines)'.format(fn, len(sources), len(lines)))
예제 #15
0
파일: conf.py 프로젝트: xyalan/docs
import sys
import os.path

project_root = os.path.join(os.path.abspath(os.path.dirname(__file__)))

sys.path.append(project_root)

from bootstrap import buildsystem

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'sphinxext')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'bin')))

from utils import ingest_yaml, ingest_yaml_list
meta = ingest_yaml(os.path.join(project_root, 'meta.yaml'))
pdfs = ingest_yaml_list(os.path.join(project_root, 'pdfs.yaml'))
intersphinx_libs = ingest_yaml_list(os.path.join(project_root, 'intersphinx.yaml'))

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
예제 #16
0
#
# MongoDB documentation build configuration file, created by
# sphinx-quickstart on Mon Oct  3 09:58:40 2011.
#
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path
import yaml

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
                                             'bin')))
import utils

meta = utils.ingest_yaml('meta.yaml')
pdfs = utils.ingest_yaml_list('pdfs.yaml')

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb_domain',
    'additional_directives',
]

templates_path = ['.templates']
exclude_patterns = []
예제 #17
0
sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from bootstrap import buildsystem

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), buildsystem, 'sphinxext')))
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem,
                                 'bin')))

from utils import ingest_yaml, ingest_yaml_list

meta = ingest_yaml('meta.yaml')
pdfs = ingest_yaml_list('pdfs.yaml')
intersphinx_libs = ingest_yaml_list('intersphinx.yaml')

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
예제 #18
0
def _generate_api_param(source, target):
    r = generate_params(ingest_yaml_list(source), source)
    r.write(target)

    puts('[api]: rebuilt {0}'.format(target))
예제 #19
0
def pdf_jobs():
    conf = get_conf()

    pdfs = ingest_yaml_list(os.path.join(conf.build.paths.builddata, 'pdfs.yaml'))
    tex_regexes = [(re.compile(r'(index|bfcode)\{(.*)--(.*)\}'), r'\1\{\2-\{-\}\3\}'),
                   (re.compile(r'\\PYGZsq{}'), "'"),
                   (re.compile(r'\\code\{/(?!.*{}/|etc|usr|data|var|srv)'), r'\code{' + conf.project.url + r'/' + conf.project.tag) ]

    # this is temporary
    queue = ( [], [], [], [], [] )
    pdfs.sort()

    for i in pdfs:
        tagged_name = i['output'][:-4] + '-' + i['tag']
        deploy_fn = tagged_name + '-' + conf.git.branches.current + '.pdf'
        link_name = deploy_fn.replace('-' + conf.git.branches.current, '')

        if 'edition' in i:
            deploy_path = os.path.join(conf.build.paths.public, i['edition'])
            if i['edition'] == 'hosted':
                deploy_path = os.path.join(deploy_path,  conf.git.branches.current)
                latex_dir = os.path.join(conf.build.paths.output, i['edition'], conf.git.branches.current, 'latex')
            else:
                latex_dir = os.path.join(conf.build.paths.output, i['edition'], 'latex')
                deploy_fn = tagged_name + '.pdf'
                link_name = deploy_fn
        else:
            deploy_path = conf.build.paths['branch-staging']
            latex_dir = os.path.join(conf.build.paths['branch-output'], 'latex')

        i['source'] = os.path.join(latex_dir, i['output'])
        i['processed'] = os.path.join(latex_dir, tagged_name + '.tex')
        i['pdf'] = os.path.join(latex_dir, tagged_name + '.pdf')
        i['deployed'] = os.path.join(deploy_path, deploy_fn)
        i['link'] = os.path.join(deploy_path, link_name)
        i['path'] = latex_dir

        # these appends will become yields, once runner() can be dependency
        # aware.
        queue[0].append(dict(dependency=None,
                             target=i['source'],
                             job=_clean_sphinx_latex,
                             args=(i['source'], tex_regexes)))

        queue[1].append(dict(dependency=i['source'],
                             target=i['processed'],
                             job=_copy_if_needed,
                             args=(i['source'], i['processed'], 'pdf')))

        queue[2].append(dict(dependency=i['processed'],
                             target=i['pdf'],
                             job=_render_tex_into_pdf,
                             args=(i['processed'], i['path'])))

        queue[3].append(dict(dependency=i['pdf'],
                             target=i['deployed'],
                             job=_copy_if_needed,
                             args=(i['pdf'], i['deployed'], 'pdf')))

        if i['link'] != i['deployed']:
            queue[4].append(dict(dependency=i['deployed'],
                                 target=i['link'],
                                 job=_create_link,
                                 args=(deploy_fn, i['link'])))

    return queue
예제 #20
0
import datetime

project_root = os.path.join(os.path.abspath(os.path.dirname(__file__)))

sys.path.append(project_root)

from bootstrap import buildsystem

sys.path.append(os.path.join(project_root, buildsystem, 'sphinxext'))
sys.path.append(os.path.join(project_root, buildsystem, 'bin'))

from utils import ingest_yaml, ingest_yaml_list
from docs_meta import get_conf, get_versions, get_manual_path

conf = get_conf()
pdfs = ingest_yaml_list(os.path.join(conf.build.paths.builddata, 'pdfs.yaml'))
intersphinx_libs = ingest_yaml_list(
    os.path.join(conf.build.paths.builddata, 'intersphinx.yaml'))

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]
예제 #21
0
파일: conf.py 프로젝트: reqshark/docs
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path

sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from bootstrap import buildsystem

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, "sphinxext")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, "bin")))

from utils import ingest_yaml, ingest_yaml_list

meta = ingest_yaml("meta.yaml")
pdfs = ingest_yaml_list("pdfs.yaml")

# -- General configuration ----------------------------------------------------

needs_sphinx = "1.0"

extensions = ["sphinx.ext.intersphinx", "sphinx.ext.extlinks", "sphinx.ext.todo", "mongodb", "directives"]

templates_path = [".templates"]
exclude_patterns = []

source_suffix = ".txt"

master_doc = "contents"
language = "en"
project = u"mongodb-manual"
예제 #22
0
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path

sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from bootstrap import buildsystem

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'sphinxext')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'bin')))

from utils import ingest_yaml, ingest_yaml_list

meta = ingest_yaml('meta.yaml')
pdfs = ingest_yaml_list('pdfs.yaml')


# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
예제 #23
0
파일: conf.py 프로젝트: Necromos/docs
project_root = os.path.join(os.path.abspath(os.path.dirname(__file__)))

sys.path.append(project_root)

from bootstrap import buildsystem

sys.path.append(os.path.join(project_root, buildsystem, 'sphinxext'))
sys.path.append(os.path.join(project_root, buildsystem, 'bin'))

from utils import ingest_yaml, ingest_yaml_list
from docs_meta import get_conf, get_versions, get_manual_path

conf = get_conf()
conf.build.paths.projectroot = project_root
pdfs = ingest_yaml_list(os.path.join(conf.build.paths.builddata, 'pdfs.yaml'))
intersphinx_libs = ingest_yaml_list(os.path.join(conf.build.paths.builddata, 'intersphinx.yaml'))

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
예제 #24
0
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path

sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from bootstrap import buildsystem

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'sphinxext')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), buildsystem, 'bin')))

from utils import ingest_yaml, ingest_yaml_list

meta = ingest_yaml('meta.yaml')
pdfs = ingest_yaml_list('pdfs.yaml')
intersphinx_libs = ingest_yaml_list('intersphinx.yaml')

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
    'intermanual'
]

templates_path = ['.templates']
예제 #25
0
파일: conf.py 프로젝트: Bernadskaya/docs
#
# MongoDB documentation build configuration file, created by
# sphinx-quickstart on Mon Oct  3 09:58:40 2011.
#
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path
import yaml

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'bin')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'bin/sphinxext')))
import utils

meta = utils.ingest_yaml('meta.yaml')
pdfs = utils.ingest_yaml_list('pdfs.yaml')

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
exclude_patterns = []
예제 #26
0
# MongoDB documentation build configuration file, created by
# sphinx-quickstart on Mon Oct  3 09:58:40 2011.
#
# This file is execfile()d with the current directory set to its containing dir.

import sys
import os.path

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
                                             'bin')))
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), 'bin/sphinxext')))
from utils import ingest_yaml, ingest_yaml_list

meta = ingest_yaml('meta.yaml')
pdfs = ingest_yaml_list('pdfs.yaml')

# -- General configuration ----------------------------------------------------

needs_sphinx = '1.0'

extensions = [
    'sphinx.ext.intersphinx',
    'sphinx.ext.extlinks',
    'sphinx.ext.todo',
    'mongodb',
    'directives',
]

templates_path = ['.templates']
exclude_patterns = []