mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 11:50:21 +00:00
Remove handling for older versions of pycddl
>=0.4 is now a hard-requirement
This commit is contained in:
parent
55139bb3f9
commit
e2eac5855c
@ -11,7 +11,6 @@ import binascii
|
|||||||
from tempfile import TemporaryFile
|
from tempfile import TemporaryFile
|
||||||
from os import SEEK_END, SEEK_SET
|
from os import SEEK_END, SEEK_SET
|
||||||
import mmap
|
import mmap
|
||||||
from importlib.metadata import version as get_package_version, PackageNotFoundError
|
|
||||||
|
|
||||||
from cryptography.x509 import Certificate as CryptoCertificate
|
from cryptography.x509 import Certificate as CryptoCertificate
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
@ -60,20 +59,6 @@ from ..util.base32 import rfc3548_alphabet
|
|||||||
from allmydata.interfaces import BadWriteEnablerError
|
from allmydata.interfaces import BadWriteEnablerError
|
||||||
|
|
||||||
|
|
||||||
# Until we figure out Nix (https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3963),
|
|
||||||
# need to support old pycddl which can only take bytes:
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
try:
|
|
||||||
PYCDDL_BYTES_ONLY = LooseVersion(get_package_version("pycddl")) < LooseVersion(
|
|
||||||
"0.4"
|
|
||||||
)
|
|
||||||
except PackageNotFoundError:
|
|
||||||
# This can happen when building PyInstaller distribution. We'll just assume
|
|
||||||
# you installed a modern pycddl, cause why wouldn't you?
|
|
||||||
PYCDDL_BYTES_ONLY = False
|
|
||||||
|
|
||||||
|
|
||||||
class ClientSecretsException(Exception):
|
class ClientSecretsException(Exception):
|
||||||
"""The client did not send the appropriate secrets."""
|
"""The client did not send the appropriate secrets."""
|
||||||
|
|
||||||
@ -572,7 +557,7 @@ class HTTPServer(object):
|
|||||||
fd = request.content.fileno()
|
fd = request.content.fileno()
|
||||||
except (ValueError, OSError):
|
except (ValueError, OSError):
|
||||||
fd = -1
|
fd = -1
|
||||||
if fd >= 0 and not PYCDDL_BYTES_ONLY:
|
if fd >= 0:
|
||||||
# It's a file, so we can use mmap() to save memory.
|
# It's a file, so we can use mmap() to save memory.
|
||||||
message = mmap.mmap(fd, 0, access=mmap.ACCESS_READ)
|
message = mmap.mmap(fd, 0, access=mmap.ACCESS_READ)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user