diff --git a/bob/devtools/bootstrap.py b/bob/devtools/bootstrap.py index 40b9fb72d01ed7e5d4e5a0760c1f9aaea9bf4a08..7b3d69559ec368795430220d310628cc709beba6 100644 --- a/bob/devtools/bootstrap.py +++ b/bob/devtools/bootstrap.py @@ -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 diff --git a/bob/devtools/build.py b/bob/devtools/build.py index cb174dc3a6e2e639ff06e595db1e09bff6cf89ed..b04b7becf6cdc20b999a6fffdbdbec23be1cd086 100644 --- a/bob/devtools/build.py +++ b/bob/devtools/build.py @@ -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 diff --git a/bob/devtools/scripts/build.py b/bob/devtools/scripts/build.py index 5d0fe9de547d6304dffbe55e8b6f18148c58355e..2242ccee4e51fabdb3fa512e9a882653e39dff73 100644 --- a/bob/devtools/scripts/build.py +++ b/bob/devtools/scripts/build.py @@ -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):