Skip to content

Commit

Permalink
Require compression program, should fix failing tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wummel committed Sep 24, 2024
1 parent 83cab2a commit cf9926c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions patoolib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,13 @@ def program_supports_compression(program, exe, compression):
# * tar programs allow long option --<compression> for supported compressions
# This way running "tar --<compression> --help" determines, if the compression is supported
cmd = [exe, f"--{compression}", "--help"]
retcode = util.run(cmd, stderr=subprocess.DEVNULL, verbosity=-1)
return retcode == 0
if util.run(cmd, stderr=subprocess.DEVNULL, verbosity=-1) != 0:
# compression is not supported by this tar implementation
return False
# in addition to the commandline option, tar also needs the corresponding compression program
if util.find_program(compression):
# the compression program is available for tar
return True
elif program in ('py_tarfile',):
# the python tarfile module has a fixed list of supported compression modules
return compression in ('gzip', 'bzip2', 'lzma', 'xz')
Expand Down

0 comments on commit cf9926c

Please sign in to comment.