diff --git a/conda_build/cli/main_build.py b/conda_build/cli/main_build.py index fd8db83144..fc0beca311 100644 --- a/conda_build/cli/main_build.py +++ b/conda_build/cli/main_build.py @@ -24,7 +24,6 @@ from conda_build.config import Config on_win = (sys.platform == 'win32') -logging.basicConfig(level=logging.INFO) def parse_args(args): @@ -216,6 +215,10 @@ def execute(args): action = check_action if action: + if action == output_action: + logging.basicConfig(level=logging.ERROR) + else: + logging.basicConfig(level=logging.INFO) for recipe in args.recipe: recipe_dir, need_cleanup = get_recipe_abspath(recipe) diff --git a/conda_build/cli/main_render.py b/conda_build/cli/main_render.py index d021acd9c1..8887e88078 100644 --- a/conda_build/cli/main_render.py +++ b/conda_build/cli/main_render.py @@ -20,8 +20,6 @@ on_win = (sys.platform == 'win32') -logging.basicConfig(level=logging.INFO) - def get_render_parser(): p = ArgumentParser( @@ -131,9 +129,11 @@ def execute(args): metadata, _, _ = render_recipe(args.recipe, no_download_source=args.no_source, config=config) if args.output: + logging.basicConfig(level=logging.ERROR) silence_loggers(show_warnings_and_errors=False) print(bldpkg_path(metadata, config=config)) else: + logging.basicConfig(level=logging.INFO) print(output_yaml(metadata, args.file)) diff --git a/conda_build/environ.py b/conda_build/environ.py index 9fae248f63..7217467e69 100644 --- a/conda_build/environ.py +++ b/conda_build/environ.py @@ -19,6 +19,8 @@ from conda_build.features import feature_list from conda_build.utils import prepend_bin_path +log = logging.getLogger(__file__) + def get_perl_ver(config): return str(config.CONDA_PERL) diff --git a/conda_build/utils.py b/conda_build/utils.py index 9eeeb579ca..e64fdf8412 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -343,6 +343,8 @@ def silence_loggers(show_warnings_and_errors=True): log_level = logging.WARN else: log_level = logging.CRITICAL + 1 + logging.disable(log_level) + logging.getLogger(os.path.dirname(__file__)).setLevel(log_level) # This squelches a ton of conda output that is not hugely relevant logging.getLogger("conda").setLevel(log_level) logging.getLogger("binstar").setLevel(log_level) diff --git a/tests/test_cli.py b/tests/test_cli.py index 4a82213c91..bf2a3ed633 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -53,6 +53,7 @@ def test_render_output_build_path(testing_workdir, capfd): test_path = "conda-build-test-python-run-1.0-py{}{}_0.tar.bz2".format( sys.version_info.major, sys.version_info.minor) output, error = capfd.readouterr() + assert error == "" assert os.path.basename(output.rstrip()) == test_path, error @@ -63,6 +64,7 @@ def test_build_output_build_path(testing_workdir, test_config, capfd): "conda-build-test-python-run-1.0-py{}{}_0.tar.bz2".format( sys.version_info.major, sys.version_info.minor)) output, error = capfd.readouterr() + assert error == "" assert output.rstrip() == test_path, error