8000 more diff-friendly disabling xz · RustPython/RustPython@acae154 · GitHub
[go: up one dir, main page]

Skip to content

Commit acae154

Browse files
committed
more diff-friendly disabling xz
1 parent a501644 commit acae154

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

Lib/tarfile.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,13 @@ def __init__(self, name, mode, comptype, fileobj, bufsize,
392392

393393
elif comptype == "xz":
394394
try:
395-
# TODO: RUSTPYTHON remove underscore
396-
import lzma_
395+
import lzma
397396
except ImportError:
398397
raise CompressionError("lzma module is not available") from None
398+
399+
# XXX: RUSTPYTHON; xz is not supported yet
400+
raise CompressionError("lzma module is not available") from None
401+
399402
if mode == "r":
400403
self.dbuf = b""
401404
self.cmp = lzma.LZMADecompressor()
@@ -1924,11 +1927,13 @@ def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
19241927
raise ValueError("mode must be 'r', 'w' or 'x'")
19251928

19261929
try:
1927-
# TODO: RUSTPYTHON remove underscore
1928-
from lzma_ import LZMAFile, LZMAError
1930+
from lzma import LZMAFile, LZMAError
19291931
except ImportError:
19301932
raise CompressionError("lzma module is not available") from None
19311933

1934+
# XXX: RUSTPYTHON; xz is not supported yet
1935+
raise CompressionError("lzma module is not available") from None
1936+
19321937
fileobj = LZMAFile(fileobj or name, mode, preset=preset)
19331938

19341939
try:

Lib/test/support/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,11 @@ def requires_bz2(reason='requires bz2'):
494494
return unittest.skipUnless(bz2, reason)
495495

496496
def requires_lzma(reason='requires lzma'):
497-
# try:
498-
# import lzma
499-
# except ImportError:
500-
# lzma = None
501-
# TODO: RUSTPYTHON
497+
try:
498+
import lzma
499+
except ImportError:
500+
lzma = None
501+
# XXX: RUSTPYTHON; xz is not supported yet
502502
lzma = None
503503
return unittest.skipUnless(lzma, reason)
504504

Lib/test/test_tarfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
except ImportError:
2929
bz2 = None
3030
try:
31-
# TODO: RUSTPYTHON
32-
lzma = None
33-
# import lzma
31+
import lzma
3432
except ImportError:
3533
lzma = None
34+
# XXX: RUSTPYTHON; xz is not supported yet
35+
lzma = None
3636

3737
def sha256sum(data):
3838
return sha256(data).hexdigest()

0 commit comments

Comments
 (0)
0