mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
more diff-friendly disabling xz
This commit is contained in:
1 parent
a5016446f4
commit
acae154f1b
3 files changed
+17
-12
No files matched your search
Vendored
+9
-4
@@ -392,10 +392,13 @@ class _Stream:
|
||||
|
||||
elif comptype == "xz":
|
||||
try:
|
||||
# TODO: RUSTPYTHON remove underscore
|
||||
import lzma_
|
||||
import lzma
|
||||
except ImportError:
|
||||
raise CompressionError("lzma module is not available") from None
|
||||
|
||||
# XXX: RUSTPYTHON; xz is not supported yet
|
||||
raise CompressionError("lzma module is not available") from None
|
||||
|
||||
if mode == "r":
|
||||
self.dbuf = b""
|
||||
self.cmp = lzma.LZMADecompressor()
|
||||
@@ -1924,11 +1927,13 @@ class TarFile(object):
|
||||
raise ValueError("mode must be 'r', 'w' or 'x'")
|
||||
|
||||
try:
|
||||
# TODO: RUSTPYTHON remove underscore
|
||||
from lzma_ import LZMAFile, LZMAError
|
||||
from lzma import LZMAFile, LZMAError
|
||||
except ImportError:
|
||||
raise CompressionError("lzma module is not available") from None
|
||||
|
||||
# XXX: RUSTPYTHON; xz is not supported yet
|
||||
raise CompressionError("lzma module is not available") from None
|
||||
|
||||
fileobj = LZMAFile(fileobj or name, mode, preset=preset)
|
||||
|
||||
try:
|
||||
|
||||
Vendored
+5
-5
@@ -494,11 +494,11 @@ def requires_bz2(reason='requires bz2'):
|
||||
return unittest.skipUnless(bz2, reason)
|
||||
|
||||
def requires_lzma(reason='requires lzma'):
|
||||
# try:
|
||||
# import lzma
|
||||
# except ImportError:
|
||||
# lzma = None
|
||||
# TODO: RUSTPYTHON
|
||||
try:
|
||||
import lzma
|
||||
except ImportError:
|
||||
lzma = None
|
||||
# XXX: RUSTPYTHON; xz is not supported yet
|
||||
lzma = None
|
||||
return unittest.skipUnless(lzma, reason)
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -28,11 +28,11 @@ try:
|
||||
except ImportError:
|
||||
bz2 = None
|
||||
try:
|
||||
# TODO: RUSTPYTHON
|
||||
lzma = None
|
||||
# import lzma
|
||||
import lzma
|
||||
except ImportError:
|
||||
lzma = None
|
||||
# XXX: RUSTPYTHON; xz is not supported yet
|
||||
lzma = None
|
||||
|
||||
def sha256sum(data):
|
||||
return sha256(data).hexdigest()
|
||||
|
||||
Reference in new issue
Block a user