Commit 58476350 authored by André Anjos's avatar André Anjos 💬
Browse files

[build] Add support for setting up BOB_DOCUMENTATION_SERVER for...

[build] Add support for setting up BOB_DOCUMENTATION_SERVER for bob.extension-based Sphinx doc builds
parent 8fa9a42c
Pipeline #26046 passed with stages
in 6 minutes and 3 seconds
......@@ -282,12 +282,12 @@ def get_channels(public, stable, server, intranet):
'''
channels = []
if (not public) and (not intranet):
raise RuntimeError('You cannot request for private channels and set' \
' intranet=False (server=%s) - these are conflicting options' % server)
channels = []
if not public:
prefix = '/private' if intranet else ''
if not stable: #allowed private channels
......
......@@ -247,6 +247,73 @@ def conda_create(conda, name, overwrite, condarc, packages, dry_run, use_local):
yaml.dump(condarc, f, indent=2)
def get_docserver_setup(public, stable, server, intranet):
'''Returns a setup for BOB_DOCUMENTATION_SERVER
What is available to build the documentation depends on the setup of
``public`` and ``stable``:
* public and stable: only returns the public stable channel(s)
* public and not stable: returns both public stable and beta channels
* not public and stable: returns both public and private stable channels
* not public and not stable: returns all channels
Beta channels have priority over stable channels, if returned. Private
channels have priority over public channles, if turned.
Args:
public: Boolean indicating if we're supposed to include only public
channels
stable: Boolean indicating if we're supposed to include only stable
channels
server: The base address of the server containing our conda channels
intranet: Boolean indicating if we should add "private"/"public" prefixes
on the returned paths
Returns: a string to be used by bob.extension to find dependent
documentation projects.
'''
if (not public) and (not intranet):
raise RuntimeError('You cannot request for private channels and set' \
' intranet=False (server=%s) - these are conflicting options' % server)
entries = []
# public documentation: always can access
prefix = '/software/bob'
if server.endswith(prefix): # don't repeat yourself...
prefix = ''
if stable:
entries += [
server + prefix + '/docs/bob/%(name)s/%(version)s/',
server + prefix + '/docs/bob/%(name)s/stable/',
]
else:
entries += [
server + prefix + '/docs/bob/%(name)s/master/',
]
if private:
# add private channels, (notice they are not accessible outside idiap)
prefix = '/private' if intranet else ''
if stable:
entries += [
server + prefix + '/docs/bob/%(name)s/%(version)s/',
server + prefix + '/docs/bob/%(name)s/stable/',
]
else:
entries += [
server + prefix + '/docs/bob/%(name)s/master/',
]
return '|'.join(entries)
if __name__ == '__main__':
# loads the "adjacent" bootstrap module
......
......@@ -13,7 +13,8 @@ import yaml
from . import bdt
from ..log import verbosity_option
from ..build import next_build_number, conda_arch, should_skip_build, \
get_rendered_metadata, get_parsed_recipe, make_conda_config
get_rendered_metadata, get_parsed_recipe, make_conda_config, \
get_docserver_setup
from ..constants import CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \
SERVER, MATPLOTLIB_RCDIR, BASE_CONDARC
from ..bootstrap import set_environment, get_channels
......@@ -108,9 +109,15 @@ def build(recipe_dir, python, condarc, config, no_test, append_file,
set_environment('LANG', 'en_US.UTF-8', os.environ)
set_environment('LC_ALL', os.environ['LANG'], os.environ)
set_environment('DOCSERVER', server, os.environ)
set_environment('MATPLOTLIBRC', MATPLOTLIB_RCDIR, os.environ)
# setup BOB_DOCUMENTATION_SERVER environment variable (used for bob.extension
# and derived documentation building via Sphinx)
set_environment('DOCSERVER', server, os.environ)
doc_urls = get_docserver_setup(public=(not private), stable=stable,
server=server, intranet=private)
set_environment('BOB_DOCUMENTATION_SERVER', doc_urls, server=server)
for d in recipe_dir:
if not os.path.exists(d):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment