From e2eac5855c3c35f3b5903922213eda58fd2d707f Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Mon, 23 Jan 2023 08:52:00 -0500
Subject: [PATCH] Remove handling for older versions of pycddl

>=0.4 is now a hard-requirement
---
 src/allmydata/storage/http_server.py | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/allmydata/storage/http_server.py b/src/allmydata/storage/http_server.py
index 387353d24..094b29c04 100644
--- a/src/allmydata/storage/http_server.py
+++ b/src/allmydata/storage/http_server.py
@@ -11,7 +11,6 @@ import binascii
 from tempfile import TemporaryFile
 from os import SEEK_END, SEEK_SET
 import mmap
-from importlib.metadata import version as get_package_version, PackageNotFoundError
 
 from cryptography.x509 import Certificate as CryptoCertificate
 from zope.interface import implementer
@@ -60,20 +59,6 @@ from ..util.base32 import rfc3548_alphabet
 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):
     """The client did not send the appropriate secrets."""
 
@@ -572,7 +557,7 @@ class HTTPServer(object):
             fd = request.content.fileno()
         except (ValueError, OSError):
             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.
             message = mmap.mmap(fd, 0, access=mmap.ACCESS_READ)
         else: