Skip to content
Snippets Groups Projects
Commit a38408ef authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Prepared the doc build inside of 'bob ci docs'

parent 8f6aee32
No related branches found
No related tags found
1 merge request!59Created the CLI command 'bdt ci docs' to replace the before_build.sh
Pipeline #30379 failed
#!/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
...@@ -10,7 +10,7 @@ import click ...@@ -10,7 +10,7 @@ import click
import pkg_resources import pkg_resources
from click_plugins import with_plugins from click_plugins import with_plugins
from . import bdt, read_packages from . import bdt
from ..constants import SERVER, CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \ from ..constants import SERVER, CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \
WEBDAV_PATHS, BASE_CONDARC WEBDAV_PATHS, BASE_CONDARC
from ..deploy import deploy_conda_package, deploy_documentation from ..deploy import deploy_conda_package, deploy_documentation
...@@ -19,6 +19,26 @@ from ..log import verbosity_option, get_logger, echo_normal ...@@ -19,6 +19,26 @@ from ..log import verbosity_option, get_logger, echo_normal
logger = get_logger(__name__) 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')) @with_plugins(pkg_resources.iter_entry_points('bdt.ci.cli'))
@click.group(cls=bdt.AliasedGroup) @click.group(cls=bdt.AliasedGroup)
def ci(): def ci():
...@@ -667,6 +687,8 @@ def docs(ctx, requirement, dry_run): ...@@ -667,6 +687,8 @@ def docs(ctx, requirement, dry_run):
# in the documentation of this function # in the documentation of this function
extra_intersphinx = [] extra_intersphinx = []
nitpick = [] nitpick = []
doc_path = os.path.join(os.environ['CI_PROJECT_DIR'], 'doc')
for n, (package, branch) in enumerate(packages): for n, (package, branch) in enumerate(packages):
echo_normal('\n' + (80*'=')) echo_normal('\n' + (80*'='))
...@@ -674,7 +696,6 @@ def docs(ctx, requirement, dry_run): ...@@ -674,7 +696,6 @@ def docs(ctx, requirement, dry_run):
len(packages))) len(packages)))
echo_normal((80*'=') + '\n') echo_normal((80*'=') + '\n')
doc_path = os.path.join(os.environ['CI_PROJECT_DIR'], 'doc')
clone_to = os.path.join(doc_path, package) clone_to = os.path.join(doc_path, package)
dirname = os.path.dirname(clone_to) dirname = os.path.dirname(clone_to)
if not os.path.exists(dirname): if not os.path.exists(dirname):
...@@ -712,13 +733,15 @@ def docs(ctx, requirement, dry_run): ...@@ -712,13 +733,15 @@ def docs(ctx, requirement, dry_run):
logger.info('Generating sphinx files') logger.info('Generating sphinx files')
# Making unique lists # Making unique lists and removing all bob references
extra_intersphinx = list(set([e for e in extra_intersphinx if group not in e ])) if not dry_run:
nitpick = list(set([e for e in nitpick])) 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 # 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, "extra-intersphinx.txt"), "w").writelines(extra_intersphinx)
open(os.path.join(doc_path, "nitpick-exceptions.txt"), "w").writelines(nitpick) 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)
...@@ -65,7 +65,7 @@ test: ...@@ -65,7 +65,7 @@ test:
- bdt caupdate --help - bdt caupdate --help
- bdt new --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" -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 new -t "New package" -l bsd -o beat.foobar beat/beat.foobar "John Doe" "joe.doe@example.com"
- bdt gitlab --help - bdt gitlab --help
- bdt gitlab lasttag --help - bdt gitlab lasttag --help
...@@ -90,6 +90,7 @@ test: ...@@ -90,6 +90,7 @@ test:
- bdt ci readme --help - bdt ci readme --help
- bdt ci clean --help - bdt ci clean --help
- bdt ci nightlies --help - bdt ci nightlies --help
- bdt ci docs --help
- sphinx-build -aEW ${PREFIX}/share/doc/{{ name }}/doc sphinx - sphinx-build -aEW ${PREFIX}/share/doc/{{ name }}/doc sphinx
- if [ -n "${CI_PROJECT_DIR}" ]; then mv sphinx "${CI_PROJECT_DIR}/"; fi - if [ -n "${CI_PROJECT_DIR}" ]; then mv sphinx "${CI_PROJECT_DIR}/"; fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment