From a38408eff236fa06376a933adf60ac2857b088ee Mon Sep 17 00:00:00 2001 From: Tiago Freitas Pereira <tiagofrepereira@gmail.com> Date: Wed, 22 May 2019 09:12:28 +0200 Subject: [PATCH] Prepared the doc build inside of 'bob ci docs' --- bob/devtools/scripts/__init__.py | 20 ---------------- bob/devtools/scripts/ci.py | 41 +++++++++++++++++++++++++------- conda/meta.yaml | 3 ++- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/bob/devtools/scripts/__init__.py b/bob/devtools/scripts/__init__.py index 7e0ced97..8b137891 100644 --- a/bob/devtools/scripts/__init__.py +++ b/bob/devtools/scripts/__init__.py @@ -1,21 +1 @@ -#!/usr/bin/env python - -def read_packages(filename): - """ - Return a python list given file containing one package per line - - """ - # loads dirnames from order file (accepts # comments and empty lines) - packages = [] - with open(filename, 'rt') as f: - for line in f: - line = line.partition('#')[0].strip() - if line: - if ',' in line: #user specified a branch - path, branch = [k.strip() for k in line.split(',', 1)] - packages.append((path, branch)) - else: - packages.append((line, 'master')) - - return packages diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py index 520e36d3..66ff775b 100644 --- a/bob/devtools/scripts/ci.py +++ b/bob/devtools/scripts/ci.py @@ -10,7 +10,7 @@ import click import pkg_resources from click_plugins import with_plugins -from . import bdt, read_packages +from . import bdt from ..constants import SERVER, CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \ WEBDAV_PATHS, BASE_CONDARC from ..deploy import deploy_conda_package, deploy_documentation @@ -19,6 +19,26 @@ from ..log import verbosity_option, get_logger, echo_normal logger = get_logger(__name__) +def read_packages(filename): + """ + Return a python list given file containing one package per line + + """ + # loads dirnames from order file (accepts # comments and empty lines) + packages = [] + with open(filename, 'rt') as f: + for line in f: + line = line.partition('#')[0].strip() + if line: + if ',' in line: #user specified a branch + path, branch = [k.strip() for k in line.split(',', 1)] + packages.append((path, branch)) + else: + packages.append((line, 'master')) + + return packages + + @with_plugins(pkg_resources.iter_entry_points('bdt.ci.cli')) @click.group(cls=bdt.AliasedGroup) def ci(): @@ -667,6 +687,8 @@ def docs(ctx, requirement, dry_run): # in the documentation of this function extra_intersphinx = [] nitpick = [] + doc_path = os.path.join(os.environ['CI_PROJECT_DIR'], 'doc') + for n, (package, branch) in enumerate(packages): echo_normal('\n' + (80*'=')) @@ -674,7 +696,6 @@ def docs(ctx, requirement, dry_run): len(packages))) echo_normal((80*'=') + '\n') - doc_path = os.path.join(os.environ['CI_PROJECT_DIR'], 'doc') clone_to = os.path.join(doc_path, package) dirname = os.path.dirname(clone_to) if not os.path.exists(dirname): @@ -712,13 +733,15 @@ def docs(ctx, requirement, dry_run): logger.info('Generating sphinx files') - # Making unique lists - extra_intersphinx = list(set([e for e in extra_intersphinx if group not in e ])) - nitpick = list(set([e for e in nitpick])) + # Making unique lists and removing all bob references + if not dry_run: + extra_intersphinx = list(set([e for e in extra_intersphinx if group not in e ])) + nitpick = list(set([e for e in nitpick])) - # Removing projects that are part of the group - open(os.path.join(doc_path, "extra-intersphinx.txt"), "w").writelines(extra_intersphinx) - open(os.path.join(doc_path, "nitpick-exceptions.txt"), "w").writelines(nitpick) + # Removing projects that are part of the group + open(os.path.join(doc_path, "extra-intersphinx.txt"), "w").writelines(extra_intersphinx) + open(os.path.join(doc_path, "nitpick-exceptions.txt"), "w").writelines(nitpick) - logger.info('Done!!') + logger.info('Building !!') + ctx.invoke(build, dry_run=dry_run) diff --git a/conda/meta.yaml b/conda/meta.yaml index f7f83bc7..ffeb9a5c 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -65,7 +65,7 @@ test: - bdt caupdate --help - bdt new --help - bdt new -t "New package" -o bob.foobar bob/bob.foobar "John Doe" "joe.doe@example.com" - - bdt new -t "New package" -l bsd -o bob.foobar2 bob/bob.foobar "John Doe" "joe.doe@example.com" + i- bdt new -t "New package" -l bsd -o bob.foobar2 bob/bob.foobar "John Doe" "joe.doe@example.com" - bdt new -t "New package" -l bsd -o beat.foobar beat/beat.foobar "John Doe" "joe.doe@example.com" - bdt gitlab --help - bdt gitlab lasttag --help @@ -90,6 +90,7 @@ test: - bdt ci readme --help - bdt ci clean --help - bdt ci nightlies --help + - bdt ci docs --help - sphinx-build -aEW ${PREFIX}/share/doc/{{ name }}/doc sphinx - if [ -n "${CI_PROJECT_DIR}" ]; then mv sphinx "${CI_PROJECT_DIR}/"; fi -- GitLab