Skip to content

Commit bdf5e00

Browse files
authored
Merge commit from fork
* Use `tar_xf()` everywhere * add news
1 parent 569f1e4 commit bdf5e00

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

conda_build/convert.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from typing import TYPE_CHECKING
1919

2020
from .exceptions import CondaBuildUserError
21-
from .utils import ensure_list, filter_info_files, walk
21+
from .utils import ensure_list, filter_info_files, tar_xf, walk
2222

2323
if TYPE_CHECKING:
2424
from collections.abc import Iterable
@@ -131,9 +131,7 @@ def extract_temporary_directory(file_path):
131131
"""
132132
temporary_directory = tempfile.mkdtemp()
133133

134-
source = tarfile.open(file_path)
135-
source.extractall(temporary_directory)
136-
source.close()
134+
tar_xf(file_path, temporary_directory)
137135

138136
return temporary_directory
139137

conda_build/render.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from .utils import (
4141
CONDA_PACKAGE_EXTENSION_V1,
4242
package_record_to_requirement,
43+
tar_xf,
4344
)
4445
from .variants import (
4546
filter_by_key_value,
@@ -947,8 +948,8 @@ def open_recipe(recipe: str | os.PathLike | Path) -> Iterator[Path]:
947948
yield recipe
948949
elif recipe.suffixes in [[".tar"], [".tar", ".gz"], [".tgz"], [".tar", ".bz2"]]:
949950
# extract the recipe to a temporary directory
950-
with TemporaryDirectory() as tmp, tarfile.open(recipe, "r:*") as tar:
951-
tar.extractall(path=tmp)
951+
with TemporaryDirectory() as tmp:
952+
tar_xf(recipe, tmp)
952953
yield Path(tmp)
953954
elif recipe.suffix == ".yaml":
954955
# read the recipe from the parent directory

news/tarextractall

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Enhancements
2+
3+
* <news item>
4+
5+
### Bug fixes
6+
7+
* Use `conda_build.utils.tar_xf` everywhere to avoid blind usage of `tar.extractall` in `conda render` and `conda convert`.
8+
9+
### Deprecations
10+
11+
* <news item>
12+
13+
### Docs
14+
15+
* <news item>
16+
17+
### Other
18+
19+
* <news item>

0 commit comments

Comments
 (0)