diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-12-31 20:03:29 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2021-01-04 17:43:04 +0300 |
commit | 6f8f0d86e4a66e6b43c2f9676619f3d89fae6acb (patch) | |
tree | 4225ddc40344fe92944ad3aebd150c437de34051 /calm/pkg2html.py | |
parent | b146f244ce0f015948cff181188b2696c6c996eb (diff) |
Add zstd to permitted archive compressions
Use the xtarfile module to handle zstd compressed archive.
Note this isn't quite as straightforward as 'import xtarfile as
tarfile', because it isn't precisely a drop-in replacement for tarfile,
because:
(i) the 'mode' argument to xtarfile.open() is mandatory, and
(ii) it doesn't re-export tarfile exception classes such as tarfile.ReadError
Diffstat (limited to 'calm/pkg2html.py')
-rwxr-xr-x | calm/pkg2html.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 32709bb..ffd16b0 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -49,9 +49,9 @@ import os import re import string import sys -import tarfile import textwrap import time +import xtarfile from .version import SetupVersion from . import common_constants @@ -482,7 +482,7 @@ def write_arch_listing(args, packages, arch): pass else: try: - with tarfile.open(tf) as a: + with xtarfile.open(tf, mode='r') as a: for i in a: print(' %-16s%12d %s' % (time.strftime('%Y-%m-%d %H:%M', time.gmtime(i.mtime)), i.size, i.name), file=f, end='') if i.isdir(): |