diff --git a/bob/devtools/build.py b/bob/devtools/build.py index 761573ab359757910e84793ee9e1c74e79ff2e67..83fd6c800c8bf6ea6492595fdf53403c8385750b 100644 --- a/bob/devtools/build.py +++ b/bob/devtools/build.py @@ -135,11 +135,11 @@ def make_conda_config(config, python, append_file, condarc_options): conda-build API's ``get_or_merge_config()`` function. ''' - from conda_build.api import get_or_merge_config from conda_build.conda_interface import url_path - retval = get_or_merge_config(None, variant_config_files=config, - python=python, append_sections_file=append_file, **condarc_options) + retval = conda_build.api.get_or_merge_config(None, + variant_config_files=config, python=python, + append_sections_file=append_file, **condarc_options) retval.channel_urls = [] @@ -159,22 +159,19 @@ def make_conda_config(config, python, append_file, condarc_options): def get_output_path(metadata, config): '''Renders the recipe and returns the name of the output file''' - from conda_build.api import get_output_file_paths - return get_output_file_paths(metadata, config=config)[0] + return conda_build.api.get_output_file_paths(metadata, config=config)[0] def get_rendered_metadata(recipe_dir, config): '''Renders the recipe and returns the interpreted YAML file''' - from conda_build.api import render - return render(recipe_dir, config=config) + return conda_build.api.render(recipe_dir, config=config) def get_parsed_recipe(metadata): '''Renders the recipe and returns the interpreted YAML file''' - from conda_build.api import output_yaml - output = output_yaml(metadata[0][0]) + output = conda_build.api.output_yaml(metadata[0][0]) return yaml.load(output) @@ -505,6 +502,12 @@ def base_build(bootstrap, server, intranet, group, recipe_dir, condarc_options: Pre-parsed condarc options loaded from the respective YAML file + + Returns: + + list: The list of built packages, as returned by + ``conda_build.api.build()`` + ''' # if you get to this point, tries to build the package @@ -552,7 +555,7 @@ def base_build(bootstrap, server, intranet, group, recipe_dir, # if you get to this point, just builds the package logger.info('Building %s', path) - conda_build.api.build(metadata[0][0], config=conda_config) + return conda_build.api.build(recipe_dir, config=conda_config) if __name__ == '__main__': @@ -656,8 +659,8 @@ if __name__ == '__main__': conda_config = make_conda_config(conda_build_config, args.python_version, recipe_append, condarc_options) - metadata = get_rendered_metadata(os.path.join(args.work_dir, 'conda'), - conda_config) + recipe_dir = os.path.join(args.work_dir, 'conda') + metadata = get_rendered_metadata(recipe_dir, conda_config) path = get_output_path(metadata, conda_config) # asserts we're building at the right location @@ -682,8 +685,7 @@ if __name__ == '__main__': # resolved the "wrong" build number. We'll have to reparse after setting the # environment variable BOB_BUILD_NUMBER. bootstrap.set_environment('BOB_BUILD_NUMBER', str(build_number)) - conda_build.api.build(os.path.join(args.work_dir, 'conda'), - config=conda_config) + conda_build.api.build(recipe_dir, config=conda_config) # checks if long_description of python package renders fine if args.twine_check: diff --git a/bob/devtools/scripts/build.py b/bob/devtools/scripts/build.py index de9c66686e76708397580535237dd6b83d5d90ee..c8dc8566497462a5ea4aea9b9e41f292b4d369ca 100644 --- a/bob/devtools/scripts/build.py +++ b/bob/devtools/scripts/build.py @@ -17,7 +17,7 @@ from ..constants import CONDA_BUILD_CONFIG, CONDA_RECIPE_APPEND, \ SERVER, MATPLOTLIB_RCDIR, BASE_CONDARC from ..bootstrap import set_environment, get_channels -from ..log import verbosity_option, get_logger +from ..log import verbosity_option, get_logger, echo_info logger = get_logger(__name__) @@ -153,19 +153,16 @@ def build(recipe_dir, python, condarc, config, no_test, append_file, # gets the next build number build_number, _ = next_build_number(channels[0], os.path.basename(path)) - # notice we cannot build from the pre-parsed metadata because it has - # already resolved the "wrong" build number. We'll have to reparse after - # setting the environment variable BOB_BUILD_NUMBER. - set_environment('BOB_BUILD_NUMBER', str(build_number)) - metadata = get_rendered_metadata(d, conda_config) - path = get_output_path(metadata, conda_config) - logger.info('Building %s-%s-py%s (build: %d) for %s', rendered_recipe['package']['name'], rendered_recipe['package']['version'], python.replace('.',''), build_number, arch) + if not dry_run: - conda_build.api.build(metadata[0][0], config=conda_config, notest=no_test) + # set $BOB_BUILD_NUMBER and force conda_build to reparse recipe to get it + # right + set_environment('BOB_BUILD_NUMBER', str(build_number)) + paths = conda_build.api.build(d, config=conda_config, notest=no_test) # if you get to this point, the package was successfully rebuilt - # set environment to signal caller we can upload it - os.environ['BDT_BUILD'] = path + # set environment to signal caller we may dispose of it + os.environ['BDT_BUILD'] = ':'.join(paths) diff --git a/bob/devtools/scripts/rebuild.py b/bob/devtools/scripts/rebuild.py index 0421a761e440d6ba3ad262bade8e2fa09b6f7e6d..f9ea9ccd078393879f59177a3c07e1567860333e 100644 --- a/bob/devtools/scripts/rebuild.py +++ b/bob/devtools/scripts/rebuild.py @@ -190,23 +190,14 @@ def rebuild(recipe_dir, python, condarc, config, append_file, rendered_recipe['package']['version'], python.replace('.',''), build_number, arch) - # notice we cannot build from the pre-parsed metadata because it has - # already resolved the "wrong" build number. We'll have to reparse after - # setting the environment variable BOB_BUILD_NUMBER. - set_environment('BOB_BUILD_NUMBER', str(build_number)) - metadata = get_rendered_metadata(d, conda_config) - candidate = get_output_path(metadata, conda_config) - - if os.path.exists(candidate): - logger.debug('Removing existing conda package at %s for rebuild...', - candidate) - os.unlink(candidate) - if not dry_run: - conda_build.api.build(metadata[0][0], config=conda_config, notest=False) + # set $BOB_BUILD_NUMBER and force conda_build to reparse recipe to get it + # right + set_environment('BOB_BUILD_NUMBER', str(build_number)) + paths = conda_build.api.build(d, config=conda_config, notest=False) # if you get to this point, the package was successfully rebuilt - # set environment to signal caller we can upload it - os.environ['BDT_BUILD'] = candidate + # set environment to signal caller we may dispose of it + os.environ['BDT_BUILD'] = ':'.join(paths) else: #skip build, test worked logger.info('Skipping rebuild of %s-%s-py%s (build: %d) for %s',