Repository: conda/conda-build

Issue:
--output is unusable
If dependencies are missing, then `conda build foo --output` will display `Downloading and Extracting Packages` before the filename, which makes it unusable in shell scripts and so on.


Discussion:
Newer versions of conda have changed the behavior of how conda implements its "quiet" behavior.  That's probably what you're seeing.  Please post the output of ``conda info`` so we can make sure.
```
     active environment : None
       user config file : /var/lib/buildbot/.condarc
 populated config files : /var/lib/buildbot/.condarc
          conda version : 4.4.7
    conda-build version : 3.2.2
         python version : 3.6.3.final.0
       base environment : /var/lib/buildbot/slaves/debian-stretch-amd64-2/miniconda  (writable)
           channel URLs : https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          http://conda.anaconda.org/m-labs/channel/main/linux-64
                          http://conda.anaconda.org/m-labs/channel/main/noarch
                          http://conda.anaconda.org/m-labs/channel/dev/linux-64
                          http://conda.anaconda.org/m-labs/channel/dev/noarch
                          http://conda.anaconda.org/conda-forge/label/main/linux-64
                          http://conda.anaconda.org/conda-forge/label/main/noarch
          package cache : /var/lib/buildbot/slaves/debian-stretch-amd64-2/miniconda/pkgs
                          /var/lib/buildbot/.conda/pkgs
       envs directories : /var/lib/buildbot/slaves/debian-stretch-amd64-2/miniconda/envs
                          /var/lib/buildbot/.conda/envs
               platform : linux-64
             user-agent : conda/4.4.7 requests/2.18.4 CPython/3.6.3 Linux/4.9.0-4-amd64 debian/9 glibc/2.24
                UID:GID : 108:113
             netrc file : None
           offline mode : False
```

Resolving patch:
diff --git a/conda_build/utils.py b/conda_build/utils.py
--- a/conda_build/utils.py
+++ b/conda_build/utils.py
@@ -36,6 +36,7 @@
 from .conda_interface import VersionOrder, MatchSpec
 from .conda_interface import cc_conda_build
 from .conda_interface import conda_43, Dist
+from .conda_interface import context
 # NOQA because it is not used in this file.
 from conda_build.conda_interface import rm_rf as _rm_rf # NOQA
 from conda_build.os_utils import external
@@ -806,6 +807,7 @@ def __init__(self, level=logging.WARN, handler=None, close=True):
         self.old_levels = {}
         self.handler = handler
         self.close = close
+        self.quiet = context.quiet
 
     def __enter__(self):
         for logger in LoggingContext.loggers:
@@ -816,6 +818,8 @@ def __enter__(self):
         if self.handler:
             self.logger.addHandler(self.handler)
 
+        context.quiet = True
+
     def __exit__(self, et, ev, tb):
         for logger, level in self.old_levels.items():
             logging.getLogger(logger).setLevel(level)
@@ -823,6 +827,9 @@ def __exit__(self, et, ev, tb):
             self.logger.removeHandler(self.handler)
         if self.handler and self.close:
             self.handler.close()
+
+        context.quiet = self.quiet
+
         # implicit return of None => don't swallow exceptions
 
 


Test patch: