Skip to content

Commit

Permalink
Make the output param as optional in archive method
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Yurchuk authored and Andriy Yurchuk committed May 4, 2024
1 parent 91f7016 commit 81e69cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conda_pack/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ def pack(
try:
with os.fdopen(fd, "wb") as temp_file:
with archive(
output,
temp_file,
temp_path,
arcroot,
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions conda_pack/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions conda_pack/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 81e69cc

Please sign in to comment.