Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Aug 14, 2023
1 parent 27a1f71 commit f11887b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
32 changes: 4 additions & 28 deletions conda_forge_feedstock_check_solvable/mamba_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ def print_debug(fmt, *args):

@contextlib.contextmanager
def suppress_conda_build_logging():
import conda_build.conda_interface
old_val = conda_build.conda_interface.cc_conda_build.get("log_config_file")
if "CONDA_FORGE_FEEDSTOCK_CHECK_SOLVABLE_DEBUG" in os.environ:
suppress = False
else:
Expand All @@ -144,27 +142,9 @@ def suppress_conda_build_logging():
return

try:
with tempfile.TemporaryDirectory() as tmpdir:
config_file = os.path.join(tmpdir, "logging.yaml")
with open(config_file, "w") as fp:
fp.write("""\
version: 1
loggers:
conda_build.api:
level: CRITICAL
conda_build.config:
level: CRITICAL
conda_build.metadata:
level: CRITICAL
conda_build.variants:
level: CRITICAL
urllib3:
level: CRITICAL
urllib3.connectionpool:
level: CRITICAL
""")
conda_build.conda_interface.cc_conda_build["log_config_file"] = config_file

fout = io.StringIO()
ferr = io.StringIO()
with contextlib.redirect_stdout(fout), contextlib.redirect_stderr(ferr):
with wurlitzer.pipes(stdout=outerr, stderr=wurlitzer.STDOUT):
yield None

Expand All @@ -173,11 +153,7 @@ def suppress_conda_build_logging():
traceback.print_exc()
raise e
finally:
if old_val is not None:
conda_build.conda_interface.cc_conda_build["log_config_file"] = old_val
else:
if "log_config_file" in conda_build.conda_interface.cc_conda_build:
del conda_build.conda_interface.cc_conda_build["log_config_file"]
pass


def _munge_req_star(req):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mamba_solvable.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,5 +613,5 @@ def test_pillow_solvable(tmp_path):

if __name__ == "__main__":
pth = os.path.join(os.path.dirname(__file__), "xgboost-feedstock")
assert is_recipe_solvable(pth, timeout=None, verbosity=1)[0]
assert is_recipe_solvable(pth, verbosity=1)[0]
assert is_recipe_solvable(pth, timeout=None, verbosity=2)[0]
assert is_recipe_solvable(pth, verbosity=2)[0]

0 comments on commit f11887b

Please sign in to comment.