Exemplo n.º 1
0
def generate_meta():
    m.section_break('branch/release meta', block='rel')
    m.var('manual-branch', MANUAL_BRANCH, block='rel')
    m.var('current-branch', str(utils.get_branch()), block='rel')
    m.var('last-commit', str(utils.get_commit()), block='rel')
    m.var('current-if-not-manual', str(get_manual_path()), block='rel')

    paths = render_paths(True)

    m.section_break('file system paths', block='paths')
    m.var('output', paths['output'], block='paths')
    m.var('public-output', paths['public'], block='paths')
    m.var('branch-output', paths['branch-output'], block='paths')
    m.var('rst-include', paths['includes'], block='paths')
    m.var('branch-source', paths['branch-source'], block='paths')
    m.var('public-branch-output', paths['branch-staging'], block='paths')

    generated_makefiles = []

    m.newline()
    for target in dynamic_makefiles():
        file = '/'.join([paths['output'], "makefile." + target])
        cloth = '/'.join([paths['tools'], "makecloth", target + '.py'])

        generated_makefiles.append(file)
        m.raw(['-include ' + paths['output'] + '/makefile.' + target])

        m.target(target=file, dependency=cloth, block='makefiles')
        m.job(' '.join(["$(PYTHONBIN)", cloth, file]))
        m.newline()

    m.newline()

    m.target('.PHONY', generated_makefiles)
Exemplo n.º 2
0
def generate_meta():
    m.section_break('branch/release meta', block='rel')
    m.var('manual-branch', MANUAL_BRANCH, block='rel')
    m.var('current-branch', str(utils.get_branch()), block='rel')
    m.var('last-commit', str(utils.get_commit()), block='rel')
    m.var('current-if-not-manual', str(get_manual_path()), block='rel')

    paths = render_paths(True)

    m.section_break('file system paths', block='paths')
    m.var('output', paths['output'], block='paths')
    m.var('public-output', paths['public'], block='paths')
    m.var('branch-output', paths['branch-output'], block='paths')
    m.var('rst-include', paths['includes'], block='paths')
    m.var('branch-source', paths['branch-source'], block='paths')
    m.var('public-branch-output', paths['branch-staging'], block='paths')

    generated_makefiles = []

    m.newline()
    for target in dynamic_makefiles():
        file ='/'.join([paths['output'], "makefile." + target])
        cloth = '/'.join([paths['tools'], "makecloth", target + '.py'])
        
        generated_makefiles.append(file)
        m.raw(['-include ' + paths['output'] + '/makefile.' + target])

        m.target(target=file, dependency=cloth, block='makefiles')
        m.job(' '.join(["$(PYTHONBIN)", cloth, file]))
        m.newline()

    m.newline()

    m.target('.PHONY',  generated_makefiles)
Exemplo n.º 3
0
def main():
    action_list = [
        'branch', 'commit', 'versions', 'stable', 'all', 'manual', 'yaml',
        'current-or-manual', 'output', 'paths'
    ]

    parser = argparse.ArgumentParser(
        'MongoDB Documentation Meta Data Provider')
    parser.add_argument('action',
                        choices=action_list,
                        nargs='?',
                        default='all')
    parser.add_argument('filename', nargs='?', default='meta.yaml')

    ui = parser.parse_args()

    if ui.action == 'all':
        BREAK = "\n"
        print("MongoDB Manual:" + BREAK + "     Commit: " + get_commit() +
              BREAK + "     Branch: " + get_branch() + BREAK +
              "     Manual: " + conf.git.branches.manual + BREAK +
              "     Versions: " + str(conf.version.published) + BREAK +
              "     Stable: " + str(conf.version.stable) + BREAK +
              "     Year: " + str(datetime.date.today().year) + BREAK +
              "     Path: " + get_manual_path() + BREAK + "     Version UI: " +
              str(get_versions()))
    elif ui.action == 'branch':
        print(get_branch())
    elif ui.action == 'commit':
        print(get_commit())
    elif ui.action == 'stable':
        print(conf.version.stable)
    elif ui.action == 'versions':
        print(conf.version.published)
    elif ui.action == 'manual':
        print(conf.git.branches.manual)
    elif ui.action == 'current-or-manual':
        print(get_manual_path())
    elif ui.action == 'yaml':
        output_yaml(ui.filename)
    elif ui.action == 'paths':
        render_paths('print')
Exemplo n.º 4
0
def generate_meta(conf):
    m = MakefileCloth()

    m.section_break('branch/release meta', block='rel')
    m.var('manual-branch', conf.git.branches.manual, block='rel')
    m.var('current-branch', str(utils.get_branch()), block='rel')
    m.var('last-commit', str(utils.get_commit()), block='rel')
    m.var('current-if-not-manual', conf.git.branches.manual, block='rel')

    m.section_break('file system paths', block='paths')
    m.var('output', conf.build.paths.output, block='paths')
    m.var('public-output', conf.build.paths.public, block='paths')
    m.var('branch-output', conf.build.paths['branch-output'], block='paths')
    m.var('rst-include', conf.build.paths.includes, block='paths')
    m.var('branch-source', conf.build.paths['branch-source'], block='paths')
    m.var('public-branch-output', conf.build.paths['branch-staging'], block='paths')

    generated_makefiles = []

    if 'static' in conf.build.system:
        m.section_break('static makefile includes')

        for mfile in conf.build.system.static:
            if mfile.startswith('/'):
                m.include(mfile[1:], ignore=False)
            else:
                m.include(os.path.join(os.path.abspath(os.path.join(__file__, '../../makefiles')), mfile))

    m.newline()
    m.target('.PHONY', 'meta.yaml')
    m.target('meta.yaml', block='metaymal')
    m.job('fab process.output:meta.yaml process.meta', block='metaymal')
    m.msg('[meta]: regenerated "meta.yaml"', block='metaymal')

    m.section_break('generated makefiles')

    for target in conf.build.system.files:
        fn = os.path.sep.join([conf.build.paths.output, "makefile." + target])
        cloth = os.path.join(conf.build.paths.buildsystem, "makecloth", target + '.py')

        generated_makefiles.append(fn)

        if target != 'meta':
            m.raw(['-include ' + conf.build.paths.output + '/makefile.' + target])

        m.target(target=fn, dependency=cloth, block='makefiles')
        m.job(' '.join([conf.build.system.python, cloth, fn]))
        m.newline()

    m.newline()

    m.target('.PHONY',  generated_makefiles)

    return m
Exemplo n.º 5
0
def output_yaml(fn):
    o = {
        'branch': get_branch(),
        'commit': get_commit(),
        'manual_path': get_manual_path(),
        'date': str(datetime.date.today().year),
        'version_selector': get_versions(),
        'stable': conf.version.stable,
        'published_branches': conf.git.branches.published,
        'pdfs': []
    }

    write_yaml(o, fn)
Exemplo n.º 6
0
def output_yaml(fn):
    o = {
            'branch': get_branch(),
            'commit': get_commit(),
            'manual_path': get_manual_path(),
            'date': str(datetime.date.today().year),
            'version_selector': get_versions(),
            'stable': conf.version.stable,
            'published_branches': conf.git.branches.published,
            'pdfs': []
    }

    write_yaml(o, fn)
Exemplo n.º 7
0
def output_yaml(fn):
    o = {
            'branch': get_branch(),
            'commit': get_commit(),
            'manual_path': get_manual_path(),
            'date': str(datetime.date.today().year),
            'version_selector': get_versions(),
            'stable': STABLE_RELEASE,
            'published_branches': PUBLISHED_BRANCHES,
            'pdfs': []
    }

    write_yaml(o, fn)
Exemplo n.º 8
0
def output_yaml(fn):
    o = {
            'branch': get_branch(),
            'commit': get_commit(),
            'manual_path': get_manual_path(),
            'date': str(datetime.date.today().year),
            'version_selector': get_versions(),
            'stable': STABLE_RELEASE,
            'published_branches': PUBLISHED_BRANCHES,
            'pdfs': []
    }

    write_yaml(o, fn)
Exemplo n.º 9
0
def get_conf():
    conf = load_conf()

    if os.path.exists('/etc/arch-release'):
        conf.build.system.python = 'python2'
    else:
        conf.build.system.python = 'python'

    conf.git.branches.current = get_branch()
    conf.git.commit = get_commit()

    conf.build.paths.update(render_paths('dict'))

    return conf
Exemplo n.º 10
0
def main():
    action_list = [ 'branch', 'commit', 'versions', 'stable', 'all', 'manual',
                    'yaml', 'current-or-manual', 'output', 'paths']

    parser = argparse.ArgumentParser('MongoDB Documentation Meta Data Provider')
    parser.add_argument('action', choices=action_list, nargs='?', default='all')
    parser.add_argument('filename', nargs='?', default='meta.yaml')

    ui = parser.parse_args()

    if ui.action == 'all':
        BREAK = "\n"
        print("MongoDB Manual:" + BREAK +
              "     Commit: " + get_commit() + BREAK +
              "     Branch: " + get_branch() + BREAK +
              "     Manual: " + conf.git.branches.manual + BREAK +
              "     Versions: " + str(conf.version.published) + BREAK +
              "     Stable: " + str(conf.version.stable) + BREAK +
              "     Year: " + str(datetime.date.today().year) + BREAK +
              "     Path: " + get_manual_path() + BREAK +
              "     Version UI: " + str(get_versions()))
    elif ui.action == 'branch':
        print(get_branch())
    elif ui.action == 'commit':
        print(get_commit())
    elif ui.action == 'stable':
        print(conf.version.stable)
    elif ui.action == 'versions':
        print(conf.version.published)
    elif ui.action == 'manual':
        print(conf.git.branches.manual)
    elif ui.action == 'current-or-manual':
        print(get_manual_path())
    elif ui.action == 'yaml':
        output_yaml(ui.filename)
    elif ui.action == 'paths':
        render_paths('print')
Exemplo n.º 11
0
def generate_meta():
    m.section_break('branch/release meta', block='rel')
    m.var('manual-branch', MANUAL_BRANCH, block='rel')
    m.var('current-branch', str(utils.get_branch()), block='rel')
    m.var('last-commit', str(utils.get_commit()), block='rel')
    m.var('current-if-not-manual', str(get_manual_path()), block='rel')

    paths = render_paths(True)

    m.section_break('file system paths', block='paths')
    m.var('output', paths['output'], block='paths')
    m.var('public-output', paths['public'], block='paths')
    m.var('branch-output', paths['branch-output'], block='paths')
    m.var('rst-include', paths['includes'], block='paths')
    m.var('branch-source', paths['branch-source'], block='paths')
    m.var('public-branch-output', paths['branch-staging'], block='paths')
Exemplo n.º 12
0
def generate_meta():
    m.section_break("branch/release meta", block="rel")
    m.var("manual-branch", MANUAL_BRANCH, block="rel")
    m.var("current-branch", str(utils.get_branch()), block="rel")
    m.var("last-commit", str(utils.get_commit()), block="rel")
    m.var("current-if-not-manual", str(get_manual_path()), block="rel")

    paths = render_paths(True)

    m.section_break("file system paths", block="paths")
    m.var("output", paths["output"], block="paths")
    m.var("public-output", paths["public"], block="paths")
    m.var("branch-output", paths["branch-output"], block="paths")
    m.var("rst-include", paths["includes"], block="paths")
    m.var("branch-source", paths["branch-source"], block="paths")
    m.var("public-branch-output", paths["branch-staging"], block="paths")
Exemplo n.º 13
0
def output_yaml(fn, conf=None):
    if conf is None:
        conf = load_conf()

    o = {
            'branch': get_branch(),
            'commit': get_commit(),
            'manual_path': get_manual_path(),
            'date': str(datetime.date.today().year),
            'version_selector': get_versions(),
            'stable': conf.version.stable,
            'upcoming': conf.version.upcoming,
            'published_branches': conf.git.branches.published,
            'pdfs': []
    }

    write_yaml(o, fn)
Exemplo n.º 14
0
def pull_stuff(endpoint, values):
    if not values:
        return
    g.repo = values.pop('repo', None)
    # load repo if there is an repo
    if g.repo:
        g.repo = get_repo(g.repo)
        g.commit_id = values.pop('commit_id', None)
        g.commit, isbranch = get_commit(g.repo, g.commit_id)
        g.branches = g.repo.get_branch_names(exclude=[g.commit_id])
        if isbranch:
            g.branch=g.commit_id
        else:
            g.branch='master'
        
        # load path and subpaths if there is an path
        g.path = values.get('path', '')
        g.subpaths = subpaths(g.path)
        g.directory, g.filename = os.path.split(g.path.strip('/'))
Exemplo n.º 15
0
def generate_hash_file(fn):
    r = RstCloth()

    if os.path.exists(fn):
        with open(fn, 'r') as f:
            existing = f.read()
    else:
        existing = []

    commit = utils.get_commit()

    r.directive('|commit| replace', '``{0}``'.format(commit))

    try:
        if r.get_block('_all')[0] == existing[:-1]:
            print('[build]: no new commit(s), not updating {0} ({1})'.format(fn, commit))
            return True
    except TypeError:
        print('[ERROR] [build]: problem generating {0}, continuing'.format(fn))
        with file(fn, 'a'):
            os.utime(fn, times)
    else:
        r.write(fn)
        print('[build]: regenerated {0} with new commit hash: {1}'.format(fn, commit))
Exemplo n.º 16
0
Arquivo: hash.py Projeto: sudhak/docs
def main(fn):
    r.directive("|commit| replace", "``{0}``".format(utils.get_commit()))
    r.write(fn)
Exemplo n.º 17
0
Arquivo: hash.py Projeto: sudhak/docs
def main(fn):
    r.directive('|commit| replace', '``{0}``'.format(utils.get_commit()))
    r.write(fn)