Skip to content

Commit

Permalink
Merge branch 'main' into handle-exceptions-extract
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Feb 27, 2024
2 parents 92f1ec9 + c6c7417 commit 79fb4a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 19 additions & 0 deletions news/58-progress-bars
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Do not render extraction progress bars in non-interactive runs or when `CONDA_QUIET` is set to a truthy value. (#58)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
8 changes: 7 additions & 1 deletion src/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def __call__(self, parser, namespace, values, option_string=None):
def _constructor_extract_conda_pkgs(prefix, max_workers=None):
from concurrent.futures import ProcessPoolExecutor, as_completed

import tqdm
from conda.auxlib.type_coercion import boolify
from conda.base.constants import CONDA_PACKAGE_EXTENSIONS
from conda_package_handling import api
from tqdm.auto import tqdm
Expand All @@ -155,9 +157,13 @@ def _constructor_extract_conda_pkgs(prefix, max_workers=None):
if pkg.endswith(ext):
fn = os.path.join(os.getcwd(), pkg)
flist.append(fn)
if boolify(os.environ.get("CONDA_QUIET")):
disabled = True
else:
disabled = None # only for non-tty
with ProcessPoolExecutor(max_workers=max_workers) as executor:
futures = {executor.submit(api.extract, fn): fn for fn in flist}
with tqdm(total=len(flist), leave=False) as pbar:
with tqdm(total=len(flist), leave=False, disabled=disabled) as pbar:
for future in as_completed(futures):
fn = futures[future]
try:
Expand Down

0 comments on commit 79fb4a9

Please sign in to comment.