diff --git a/bob/devtools/ci.py b/bob/devtools/ci.py index 7573de9b687e5c0fcf1773d47cfbe5f0ac16f716..dd6489de8f50e8f7bb2ac8c96176fab6f0be8e93 100644 --- a/bob/devtools/ci.py +++ b/bob/devtools/ci.py @@ -8,6 +8,7 @@ import git import distutils.version from .log import get_logger +from .build import load_order_file logger = get_logger(__name__) @@ -79,22 +80,14 @@ def is_stable(package, refname, tag, repodir): return False -def comment_cleanup(lines): - """Cleans-up comments and empty lines from textual data read from files""" - - no_comments = [k.partition("#")[0].strip() for k in lines] - return [k for k in no_comments if k] - - def read_packages(filename): """ Return a python list of tuples (repository, branch), given a file containing one package (and branch) per line. Comments are excluded """ - # loads dirnames from order file (accepts # comments and empty lines) - with open(filename, "rt") as f: - lines = comment_cleanup(f.readlines()) + + lines = load_order_file(filename) packages = [] for line in lines: diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py index 78238d101fe6cd920f36a947e2ddacbd3b95aaf0..8d35b3dbd8f72b81638d6e464dd6832b86def2aa 100644 --- a/bob/devtools/scripts/ci.py +++ b/bob/devtools/scripts/ci.py @@ -13,9 +13,9 @@ from click_plugins import with_plugins from . import bdt from ..constants import SERVER, WEBDAV_PATHS, BASE_CONDARC from ..deploy import deploy_conda_package, deploy_documentation +from ..build import comment_cleanup, load_order_file from ..ci import ( read_packages, - comment_cleanup, uniq, select_conda_build_config, select_conda_recipe_append, @@ -403,13 +403,7 @@ def base_build(order, group, python, dry_run): os.environ["CONDA_ROOT"], "conda-bld" ) - # loads dirnames from order file (accepts # comments and empty lines) - recipes = [] - with open(order, "rt") as f: - for line in f: - line = line.partition("#")[0].strip() - if line: - recipes.append(line) + recipes = load_order_file(order) import itertools from .. import bootstrap @@ -421,12 +415,12 @@ def base_build(order, group, python, dry_run): else: recipes = list(itertools.product([None], recipes)) - for order, (pyver, recipe) in enumerate(recipes): + for k, (pyver, recipe) in enumerate(recipes): echo_normal("\n" + (80 * "=")) pytext = "for python-%s " % pyver if pyver is not None else "" echo_normal( 'Building "%s" %s(%d/%d)' - % (recipe, pytext, order + 1, len(recipes)) + % (recipe, pytext, k + 1, len(recipes)) ) echo_normal((80 * "=") + "\n") if not os.path.exists(os.path.join(recipe, "meta.yaml")):