From 81e69ccbba1ca130cba617f5635d52af83057a87 Mon Sep 17 00:00:00 2001 From: Andriy Yurchuk Date: Sat, 4 May 2024 17:51:38 +0100 Subject: [PATCH] Make the output param as optional in archive method --- conda_pack/core.py | 2 +- conda_pack/formats.py | 4 ++-- conda_pack/tests/test_formats.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conda_pack/core.py b/conda_pack/core.py index 322b3af..1919699 100644 --- a/conda_pack/core.py +++ b/conda_pack/core.py @@ -412,7 +412,6 @@ def pack( try: with os.fdopen(fd, "wb") as temp_file: with archive( - output, temp_file, temp_path, arcroot, @@ -422,6 +421,7 @@ def pack( zip_64=zip_64, n_threads=n_threads, verbose=verbose, + output=output, ) as arc: packer = Packer(self.prefix, arc, dest_prefix, parcel) diff --git a/conda_pack/formats.py b/conda_pack/formats.py index 534f95e..39d9cfc 100644 --- a/conda_pack/formats.py +++ b/conda_pack/formats.py @@ -28,8 +28,8 @@ def _parse_n_threads(n_threads=1): return n_threads -def archive(output, fileobj, path, arcroot, format, compress_level=4, zip_symlinks=False, - zip_64=True, n_threads=1, verbose=False): +def archive(fileobj, path, arcroot, format, compress_level=4, zip_symlinks=False, + zip_64=True, n_threads=1, verbose=False, output=None): n_threads = _parse_n_threads(n_threads) diff --git a/conda_pack/tests/test_formats.py b/conda_pack/tests/test_formats.py index 374553b..c0fa30b 100644 --- a/conda_pack/tests/test_formats.py +++ b/conda_pack/tests/test_formats.py @@ -164,7 +164,7 @@ def test_format(tmpdir, format, zip_symlinks, root_and_paths): os.mkdir(spill_dir) with open(packed_env_path, mode='wb') as fil: - with archive(spill_dir, fil, packed_env_path, '', format, zip_symlinks=zip_symlinks) as arc: + with archive(fil, packed_env_path, '', format, zip_symlinks=zip_symlinks, output=spill_dir) as arc: for rel in paths: arc.add(join(root, rel), rel) arc.add_bytes(join(root, "file"), @@ -236,7 +236,7 @@ def test_format_parallel(tmpdir, format, root_and_paths): baseline = threading.active_count() with open(out_path, mode='wb') as fil: - with archive(out_dir, fil, out_path, '', format, n_threads=2) as arc: + with archive(fil, out_path, '', format, n_threads=2, output=out_dir) as arc: for rel in paths: arc.add(join(root, rel), rel) timeout = 5