From 96f90cdf10d9772935e4551a0ee7bbd9d0645dab Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Fri, 20 Jan 2023 21:09:28 -0500 Subject: [PATCH 1/4] news fragment --- newsfragments/3967.minor | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/3967.minor diff --git a/newsfragments/3967.minor b/newsfragments/3967.minor new file mode 100644 index 000000000..e69de29bb From 96d783534a986e2bca9ef5a00e99240aa2232c88 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 23 Jan 2023 08:37:31 -0500 Subject: [PATCH 2/4] Bump mach-nix and pypi-deps-db The newer pypi-deps-db has the pycddl release we want. The newer mach-nix is required to be compatible with fixes in that pypi-deps-db. --- nix/sources.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 950151416..18aa18e3f 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,14 +1,14 @@ { "mach-nix": { - "branch": "master", + "branch": "switch-to-nix-pypi-fetcher-2", "description": "Create highly reproducible python environments", "homepage": "", - "owner": "davhau", + "owner": "PrivateStorageio", "repo": "mach-nix", - "rev": "bdc97ba6b2ecd045a467b008cff4ae337b6a7a6b", - "sha256": "12b3jc0g0ak6s93g3ifvdpwxbyqx276k1kl66bpwz8a67qjbcbwf", + "rev": "f6d1a1841d8778c199326f95d0703c16bee2f8c4", + "sha256": "0krc4yhnpbzc4yhja9frnmym2vqm5zyacjnqb3fq9z9gav8vs9ls", "type": "tarball", - "url": "https://github.com/davhau/mach-nix/archive/bdc97ba6b2ecd045a467b008cff4ae337b6a7a6b.tar.gz", + "url": "https://github.com/PrivateStorageio/mach-nix/archive/f6d1a1841d8778c199326f95d0703c16bee2f8c4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { @@ -53,10 +53,10 @@ "homepage": "", "owner": "DavHau", "repo": "pypi-deps-db", - "rev": "5fe7d2d1c85cd86d64f4f079eef3f1ff5653bcd6", - "sha256": "0pc6mj7rzvmhh303rvj5wf4hrksm4h2rf4fsvqs0ljjdmgxrqm3f", + "rev": "5440c9c76f6431f300fb6a1ecae762a5444de5f6", + "sha256": "08r3iiaxzw9v2gq15y1m9bwajshyyz9280g6aia7mkgnjs9hnd1n", "type": "tarball", - "url": "https://github.com/DavHau/pypi-deps-db/archive/5fe7d2d1c85cd86d64f4f079eef3f1ff5653bcd6.tar.gz", + "url": "https://github.com/DavHau/pypi-deps-db/archive/5440c9c76f6431f300fb6a1ecae762a5444de5f6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } From 55139bb3f9e91ef2959853a7988624623b774114 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 23 Jan 2023 08:50:04 -0500 Subject: [PATCH 3/4] We can demand >= 0.4 now --- setup.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index a9b42d522..f867e901d 100644 --- a/setup.py +++ b/setup.py @@ -139,11 +139,10 @@ install_requires = [ "werkzeug != 2.2.0", "treq", "cbor2", - # Ideally we want 0.4+ to be able to pass in mmap(), but it's not strictly - # necessary yet until we fix the workaround to - # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3963 in - # allmydata.storage.http_server. - "pycddl", + + # 0.4 adds the ability to pass in mmap() values which greatly reduces the + # amount of copying involved. + "pycddl >= 0.4", # for pid-file support "psutil", From e2eac5855c3c35f3b5903922213eda58fd2d707f Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 23 Jan 2023 08:52:00 -0500 Subject: [PATCH 4/4] 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: