in versions/master/build.py [0: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)
sh.cp(cwd + '/.htaccess', 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)