Example #1
0
def buildTo(branch):
    print 'Building doc pages for: %s...' % (branch)
    branchCfg = config.load_config()
    if branchCfg['extra']['version'] != branch:
        updateConfigVersion(branch)
    sh.mkdocs('build', '--site-dir', 'site/%s' % (branch))
    if branchCfg['extra']['version'] != branch:
        sh.git('checkout', '--', 'mkdocs.yml')
Example #2
0
def buildTo(branch):
    print 'Building doc pages for: %s...' % (branch)
    branchCfg = config.load_config()
    if branchCfg['extra']['version'] != branch:
        updateConfigVersion(branch)
    sh.mkdocs('build', '--site-dir', 'site/%s' % (branch))
    if branchCfg['extra']['version'] != branch:
        sh.git('checkout', '--', 'mkdocs.yml')
Example #3
0
def buildForTest():
    print "Building site pages..."
    updateConfigVersion('develop')
    sh.rm('-rf', 'site')
    sh.mkdocs('build', '--clean')
    sh.git('checkout', '--', 'mkdocs.yml')

    cfg = config.load_config()
    for version in cfg['extra']['versions']:
        deployVersion(version)
Example #4
0
def buildForTest():
    print "Building site pages..."
    updateConfigVersion('develop')
    sh.rm('-rf', 'site')
    sh.mkdocs('build', '--clean')
    sh.git('checkout', '--', 'mkdocs.yml')

    cfg = config.load_config()
    for version in cfg['extra']['versions']:
        deployVersion(version)
Example #5
0
def build(cwd, site_dir):

    cfg = config.load_config()

    # sanity check - the version dirs exist as named
    for version in cfg['extra']['versions']:
        if not 'separate' in version or not version['separate']:
            d = os.path.join('versions', version['dir'])
            print('Verifying dir %s' % (d))
            if not os.path.isdir(d):
                print("The directory %s does not exist" % (d))
                return

    # sanity check - dependent_repos exist in '..'
    for repo in dependent_repos:
        d = os.path.join(cwd, '..', repo)
        print('Verifying repo dependency in %s' % (d))
        if not os.path.isdir(d):
            print("The directory %s does not exist" % (d))
            return

    # sanity check - only one latest
    latest = False
    for version in cfg['extra']['versions']:
        if not latest and 'latest' in version and version['latest']:
            print('Latest is %s' % (version['dir']))
            latest = True
        elif latest and 'latest' in version and version['latest']:
            print('ERROR: More than one version is latest.')
            print('Only one version can be latest: True.')
            print('Check mkdocs.yml.')
            return

    print("Building site pages")
    sh.rm('-rf', site_dir)
    sh.mkdocs('build', '--clean', '--site-dir', site_dir)

    for version in cfg['extra']['versions']:
        print("Building doc pages for: %s" % (version['dir']))
        if not 'separate' in version or not version['separate']:
            sh.mkdocs('build',
                      '--site-dir',
                      os.path.join(site_dir, version['dir']),
                      _cwd=os.path.join("versions", version['dir']))
        else:
            repo_dir = os.path.join(cwd, '..', 'mynewt-documentation')
            if version['dir'] != 'master':
                repo_dir = os.path.join(repo_dir, 'versions', version['dir'],
                                        'mynewt-documentation')
            sh.make('clean', _cwd=repo_dir)
            sh.make('docs', _cwd=repo_dir)
            sh.mv(os.path.join(repo_dir, '_build', 'html'),
                  os.path.join(site_dir, version['dir']))
        if 'latest' in version and version['latest']:
            sh.ln('-s', version['dir'], 'latest', _cwd=site_dir)
Example #6
0
def build(site_dir):
    # make sure there are no local mods outstanding
    repo = Repo(os.getcwd())
    if repo.is_dirty() or repo.untracked_files:
        print "ERROR: Your working directory has outstanding changes."
        print "Commit or stash them."
        return

    cfg = config.load_config()

    # sanity check that the version dirs exist as named
    for version in cfg['extra']['versions']:
        d = os.path.join('versions', version['dir'])
        print 'Verifying dir %s' % (d)
        if not os.path.isdir(d):
            print "The directory %s does not exist" % (d)
            return

    # sanity check - only one latest
    latest = False
    for version in cfg['extra']['versions']:
        if not latest and 'latest' in version and version['latest']:
            print 'Latest is %s' % (version['dir'])
            latest = True
        elif latest and 'latest' in version and version['latest']:
            print 'ERROR: More than one version is latest.'
            print 'Only one version can be latest: True.'
            print 'Check mkdocs.yml.'
            return

    print "Building site pages"
    sh.rm('-rf', site_dir)
    sh.mkdocs('build', '--clean', '--site-dir', site_dir)

    for version in cfg['extra']['versions']:
        print "Building doc pages for: %s" % (version['dir'])
        sh.mkdocs('build',
                  '--site-dir',
                  os.path.join(site_dir, version['dir']),
                  _cwd=os.path.join("versions", version['dir']))
        if 'latest' in version and version['latest']:
            sh.ln('-s', version['dir'], 'latest', _cwd=site_dir)

    # Make sure old links still work
    sh.ln('-s', 'master', 'develop', _cwd=site_dir)
Example #7
0
def build(site_dir):
    # make sure there are no local mods outstanding
    repo = Repo(os.getcwd())
    if repo.is_dirty() or repo.untracked_files:
        print "ERROR: Your working directory has outstanding changes."
        print "Commit or stash them."
        return

    cfg = config.load_config()

    # sanity check that the version dirs exist as named
    for version in cfg['extra']['versions']:
        d = os.path.join('versions', version['dir'])
        print 'Verifying dir %s' % (d)
        if not os.path.isdir(d):
            print "The directory %s does not exist" % (d)
            return

    # sanity check - only one latest
    latest = False
    for version in cfg['extra']['versions']:
        if not latest and 'latest' in version and version['latest']:
            print 'Latest is %s' % (version['dir'])
            latest = True
        elif latest and 'latest' in version and version['latest']:
            print 'ERROR: More than one version is latest.'
            print 'Only one version can be latest: True.'
            print 'Check mkdocs.yml.'
            return

    print "Building site pages"
    sh.rm('-rf', site_dir)
    sh.mkdocs('build', '--clean', '--site-dir', site_dir)

    for version in cfg['extra']['versions']:
        print "Building doc pages for: %s" % (version['dir'])
        sh.mkdocs('build', '--site-dir', os.path.join(site_dir, version['dir']), _cwd = os.path.join("versions", version['dir']))

    # Make sure old links still work
    sh.ln('-s', 'latest', 'develop', _cwd = site_dir)
    sh.ln('-s', 'latest', 'master', _cwd = site_dir)
Example #8
0
def buildForReal(site_branch):
    # make sure there are no local mods outstanding
    repo = Repo(os.getcwd())
    if repo.is_dirty() or repo.untracked_files:
        print "ERROR: Your working directory has outstanding changes."
        print "Commit or stash them."
        return

    mygit = Git(os.getcwd())
    cfg = config.load_config()

    # sanity check that the version branches exist as named
    for version in cfg['extra']['versions']:
        print 'Verifying branch %s' % (version['branch'])
        mygit.checkout(version['branch'])

    # sanity check - only one latest
    latest = False
    for version in cfg['extra']['versions']:
        if not latest and version['latest']:
            print 'Latest is %s' % (version['branch'])
            latest = True
        elif latest and version['latest']:
            print 'ERROR: More than one version is latest.'
            print 'Only one version can be latest: True.'
            print 'Check mkdocs.yml.'
            return

    mygit.checkout(site_branch)
    print "Building site pages from: %s..." % (site_branch)
    sh.rm('-rf', 'site')
    sh.mkdocs('build', '--clean')

    for version in cfg['extra']['versions']:
        sh.git('checkout', version['branch'], '--', 'docs', 'mkdocs.yml')
        deployVersion(version)
	sh.git('reset', 'HEAD', '.')
    	sh.git('checkout', '--', '.')
    sh.git('reset', 'HEAD', '.')
    sh.git('checkout', '--', '.')
Example #9
0
def build(cwd, site_dir):

    cfg = config.load_config()

    # sanity check - dependent_repos exist in '..'
    for repo in dependent_repos:
        d = path.join(cwd, '..', repo)
        print('Verifying repo dependency in {}'.format(d))
        if not path.isdir(d):
            print("The directory %s does not exist".format(d))
            return

    # return all extra repos to master in case last run failed
    for repo in revisioned_repos:
        repo_dir = path.normpath(path.join(cwd, '..', repo))
        sh.git('checkout', 'master', _cwd=repo_dir)

    # sanity check - only one latest
    latest = False
    latest_version = None
    for version in cfg['extra']['versions']:
        if not latest and 'latest' in version and version['latest']:
            print('Latest is {}'.format(version['label']))
            latest = True
            latest_version = version['label']
        elif latest and 'latest' in version and version['latest']:
            print('ERROR: More than one version is latest.')
            print('Only one version can be latest: True.')
            print('Check mkdocs.yml.')
            return

    print("Building site pages")
    sh.rm('-rf', site_dir)

    bsps = find_BSPs()
    generate_supported_boards("custom-theme/supported-boards.html", bsps)

    sh.mkdocs('build', '--clean', '--site-dir', site_dir)

    for version in cfg['extra']['versions']:
        print("Building doc pages for: {}".format(version['label']))

        if 'sha' not in version:
            sh.mkdocs('build',
                      '--site-dir',
                      path.join(site_dir, version['dir']),
                      _cwd=path.join("versions", version['dir']))

        else:
            sha = version['sha']
            for repo in mynewt_repos:
                repo_dir = path.normpath(path.join(cwd, '..', repo))
                sh.git('checkout', sha, _cwd=repo_dir)

            sha = version['nimble_sha']
            nimble_dir = path.normpath(path.join(cwd, '..', nimble_repo))
            sh.git('checkout', sha, _cwd=nimble_dir)

            repo_dir = path.normpath(
                path.join(cwd, '..', 'mynewt-documentation'))
            sh.make('clean', _cwd=repo_dir)
            sh.make('docs',
                    'O=-A cur_version={} -A latest_version={}'.format(
                        version['label'], latest_version),
                    _cwd=repo_dir)
            sh.mv(path.join(repo_dir, '_build', 'html'),
                  path.join(site_dir, version['dir']))

        if 'latest' in version and version['latest']:
            sh.ln('-s', version['dir'], 'latest', _cwd=site_dir)