Skip to content

Commit

Permalink
Merge pull request #1254 from msarahan/fix_git_output
Browse files Browse the repository at this point in the history
fix stderr showing up with git when outputting file path
  • Loading branch information
msarahan authored Aug 23, 2016
2 parents 18ff35f + d48619d commit f423538
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion conda_build/cli/main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from conda_build.config import Config

on_win = (sys.platform == 'win32')
logging.basicConfig(level=logging.INFO)


def parse_args(args):
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions conda_build/cli/main_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

on_win = (sys.platform == 'win32')

logging.basicConfig(level=logging.INFO)


def get_render_parser():
p = ArgumentParser(
Expand Down Expand Up @@ -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))


Expand Down
2 changes: 2 additions & 0 deletions conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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


Expand Down

0 comments on commit f423538

Please sign in to comment.