def sphinx_builder(target): b = 'production' m.comment(target, block=b) m.target(target, 'sphinx-prerequisites', block=b) m.job('fab sphinx.build:' + target, block=b) m.job(utils.build_platform_notification( 'Sphinx', 'completed {0} build.'.format(target)), ignore=True, block=b) m.msg('[{0}]: completed {0} build.'.format(target)) m.target(target + '-nitpick', 'sphinx-prerequisites', block=b) m.job('fab sphinx.build:' + target + ',nitpick=True', block=b) m.job(utils.build_platform_notification( 'Sphinx', 'completed {0} build.'.format(target)), ignore=True, block=b) m.msg('[{0}]: completed {0} build.'.format(target)) m.target('clean-' + target, block=b) m.job('rm -rf {0}/doctrees-{1} {0}/{1}'.format(paths['branch-output'], target), block=b) m.msg('[clean-{0}]: removed all files supporting the {0} build'.format( target))
def sphinx_builder(target): b = 'production' m.comment(target, block=b) m.target(target, 'sphinx-prerequisites', block=b) m.job('fab sphinx.build:' + target, block=b) m.job(utils.build_platform_notification('Sphinx', 'completed {0} build.'.format(target)), ignore=True, block=b) m.msg('[{0}]: completed {0} build.'.format(target)) m.target(target + '-nitpick', 'sphinx-prerequisites', block=b) m.job('fab sphinx.build:' + target + ',nitpick=True', block=b) m.job(utils.build_platform_notification('Sphinx', 'completed {0} build.'.format(target)), ignore=True, block=b) m.msg('[{0}]: completed {0} build.'.format(target)) m.target('clean-' + target, block=b) m.job('rm -rf {0}/doctrees-{1} {0}/{1}'.format(paths['branch-output'], target), block=b) m.msg('[clean-{0}]: removed all files supporting the {0} build'.format(target) )
def generate_delegated_interface(builders): branches = conf.git.branches.published current_branch = utils.get_branch() if current_branch not in branches: branches.append(current_branch) builders.append("publish") builders.append("push") builders.append("stage") targets = [] for branch in branches: m.section_break(branch, block=branch) m.newline(block=branch) for target in builders: for sync in [("foreground", "delegated.wait"), ("background", "")]: build_target = "delegated-%s-%s-%s" % (branch, target, sync[0]) targets.append(build_target) m.target(target=build_target, block=branch) m.job( job=("fab delegated.branch:{0} {1} delegated.build:{2}".format(branch, sync[1], target)), block=branch, ) if sync[0] == "foreground": m.job( job=utils.build_platform_notification("build complete", " ".join([branch, target])), ignore=True, block=branch, ) m.newline(block=branch) m.section_break("meta section", block="meta") m.newline() m.target(".PHONY", " ".join(targets), block="meta")
def generate_delegated_interface(builders): branches = mongo_meta.PUBLISHED_BRANCHES current_branch = mongo_meta.get_branch() if current_branch not in branches: branches.append(current_branch) builders.append('publish') builders.append('push') builders.append('stage') targets = [] for branch in branches: m.section_break(branch, block=branch) m.newline(block=branch) for target in builders: for sync in [('foreground', '--wait'), ('background', '')]: build_target = 'delegated-%s-%s-%s' % (branch, target, sync[0]) targets.append(build_target) m.target(target=build_target, block=branch) m.job(job=( '$(PYTHONBIN) bin/delegated-build --branch %s --target %s %s' % (branch, target, sync[1])), block=branch) if sync[0] == 'background': m.job(job=utils.build_platform_notification( 'build complete', ' '.join([branch, target])), ignore=True, block=branch) m.newline(block=branch) m.section_break('meta section', block='meta') m.newline() m.target('.PHONY', ' '.join(targets), block='meta')
def source(conf=None): if conf is None: conf = get_conf() target = os.path.join(conf.build.paths.projectroot, conf.build.paths.branch_output) if not os.path.exists(target): os.makedirs(target) puts('[sphinx-prep]: created ' + target) elif not os.path.isdir(target): abort('[sphinx-prep]: {0} exists and is not a directory'.format(target)) source_dir = os.path.join(conf.build.paths.projectroot, conf.build.paths.source) local('rsync --recursive --times --delete {0} {1}'.format(source_dir, target)) puts('[sphinx-prep]: updated source in {0}'.format(target)) with quiet(): local(build_platform_notification('Sphinx', 'Build in progress past critical phase.')) puts('[sphinx-prep]: INFO - Build in progress past critical phase.')
def make_all_sphinx(config): b = 'prereq' build_source_dir = paths['branch-output'] + '/source' config['generated-source'].insert(0, build_source_dir) m.section_break('sphinx prerequisites') m.newline() m.target('sphinx-prerequisites', config['prerequsites'], block=b) m.msg('[sphinx-prep]: build environment prepared for sphinx.', block=b) m.target('generate-source', config['generated-source'], block=b) m.job('rsync --recursive --times --delete source/ ' + build_source_dir, block=b) m.msg('[sphinx-prep]: updated source in ' + build_source_dir, block=b) info_note = 'Build in progress past critical phase.' m.job(utils.build_platform_notification('Sphinx', info_note), ignore=True, block=b) m.msg('[sphinx-prep]: INFO - ' + info_note, block=b) m.target(build_source_dir, block=b) m.job('mkdir -p ' + build_source_dir, block=b) m.msg('[sphinx-prep]: created ' + build_source_dir, block=b) m.section_break('sphinx targets', block=b) m.newline(block=b) sphinx_targets = [] for builder in config['builders']: sphinx_builder(builder) sphinx_targets.append(builder) sphinx_targets.append(builder + '-nitpick') sphinx_targets.append('clean-' + builder) m.section_break('meta', block='footer') m.newline(block='footer') m.target('.PHONY', sphinx_targets, block='footer')
def generate_delegated_interface(builders): branches = mongo_meta.PUBLISHED_BRANCHES current_branch = mongo_meta.get_branch() if current_branch not in branches: branches.append(current_branch) builders.append('publish') builders.append('push') builders.append('stage') targets = [] for branch in branches: m.section_break(branch, block=branch) m.newline(block=branch) for target in builders: for sync in [ ('foreground', '--wait'), ('background', '') ]: build_target = 'delegated-%s-%s-%s' % ( branch, target, sync[0]) targets.append(build_target) m.target(target=build_target, block=branch) m.job(job=('$(PYTHONBIN) bin/delegated-build --branch %s --target %s %s' % ( branch, target, sync[1])), block=branch) if sync[0] == 'background': m.job(job=utils.build_platform_notification('build complete', ' '.join([branch, target])), ignore=True, block=branch) m.newline(block=branch) m.section_break('meta section', block='meta') m.newline() m.target('.PHONY', ' '.join(targets), block='meta')
def generate_delegated_interface(builders): branches = conf.git.branches.published current_branch = utils.get_branch() if current_branch not in branches: branches.append(current_branch) builders.append('publish') builders.append('push') builders.append('stage') targets = [] for branch in branches: m.section_break(branch, block=branch) m.newline(block=branch) for target in builders: for sync in [ ('foreground', 'delegated.wait'), ('background', '') ]: build_target = 'delegated-%s-%s-%s' % ( branch, target, sync[0]) targets.append(build_target) m.target(target=build_target, block=branch) m.job(job=('fab delegated.branch:{0} {1} delegated.build:{2}'.format(branch, sync[1], target)), block=branch) if sync[0] == 'foreground': m.job(job=utils.build_platform_notification('build complete', ' '.join([branch, target])), ignore=True, block=branch) m.newline(block=branch) m.section_break('meta section', block='meta') m.newline() m.target('.PHONY', ' '.join(targets), block='meta')
def make_all_sphinx(sphinx): m.section_break('sphinx related variables', block='header') m.var(variable='SPHINXOPTS', value='-c ./', block='vars') m.var(variable='SPHINXBUILD', value='sphinx-build', block='vars') m.comment('defines a nitpick mode for sphinx\'s more verbose reporting', block='vars') m.raw(['ifdef NITPICK'], block='vars') m.append_var(variable='SPHINXOPTS', value='-n -w $(branch-output)/build.$(shell date +%Y%m%d%H%M).log', block='vars') m.raw(['endif'], block='vars') m.comment('variables related to paper sizing for the latex output', block='vars') m.var(variable='PAPER', value='letter', block='vars') m.var(variable='PAPEROPT_a4', value='-D latex_paper_size=a4', block='vars') m.var(variable='PAPEROPT_letter', value='-D latex_paper_size=letter', block='vars') m.comment('general sphinx variables', block='vars') m.var(variable='ALLSPHINXOPTS', value='-q -d $(branch-output)/doctrees-$@ $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(branch-output)/source', block='vars') m.comment('epub build modification and settings', block='vars') m.var(variable='epub-command', value='$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(branch-output)/epub', block='vars') m.var(variable='epub-filter', value="sed $(SED_ARGS_REGEX) -e '/^WARNING: unknown mimetype.*ignoring$$/d' -e '/^WARNING: search index.*incomplete.$$/d'", block='vars') m.section_break('sphinx prerequisites') m.target('sphinx-prerequisites', 'setup generate-source composite-pages.yaml', block='prereq') m.msg('[sphinx-prep]: completed $@ buildstep.', block='prereq') m.target('generate-source', '$(branch-output)/source tables installation-guides intersphinx generate-manpages', block='prereq') m.job('rsync --recursive --times --delete source/ $(branch-output)/source', block='prereq') m.msg('[sphinx-prep]: updated source in $(branch-output)/source', block='prereq') info_note = 'Build in progress past critical phase.' m.job(utils.build_platform_notification('Sphinx', info_note), ignore=True, block='prereq') m.msg('[sphinx-prep]: INFO - ' + info_note, block='prereq') m.target('$(branch-output)/source', block='prereq') m.job('mkdir -p $@', block='prereq') m.msg('[sphinx-prep]: created $@', block='prereq') m.section_break('sphinx targets', block='sphinx') m.comment('each sphinx target invokes and controls the sphinx build.', block='sphinx') m.newline(block='sphinx') for builder in sphinx: sphinx_builder(builder) m.target('.PHONY', '$(sphinx-targets)', block='footer')