From d1a97b0db859b33a50cdf4e290f2d21badc2eee2 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 10 Aug 2024 01:02:41 +0100 Subject: [PATCH] python3{11,12}Packages.boto: drop Boto has not seen a release since 2018, and has been officially marked as deprecated in favour of boto3 and botocore since 2021. It has required downstream patching to keep it running on newer Python versions and is broken on the new default of Python 3.12. It also requires the obsolete nose test framework that we are in the process of removing. The few packages we carry that still require boto are in poor upstream maintenance state and some of those were already broken. The NixOps AWS plugin was the last holdout that justified keeping this package, but it is now also broken. --- .../boto/0005-Don-t-mock-list-subclass.patch | 21 ------ .../boto/bug-953970_python3.8-compat.patch | 53 --------------- .../python-modules/boto/default.nix | 66 ------------------- pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 2 - 5 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 pkgs/development/python-modules/boto/0005-Don-t-mock-list-subclass.patch delete mode 100644 pkgs/development/python-modules/boto/bug-953970_python3.8-compat.patch delete mode 100644 pkgs/development/python-modules/boto/default.nix diff --git a/pkgs/development/python-modules/boto/0005-Don-t-mock-list-subclass.patch b/pkgs/development/python-modules/boto/0005-Don-t-mock-list-subclass.patch deleted file mode 100644 index 4add58640d7a..000000000000 --- a/pkgs/development/python-modules/boto/0005-Don-t-mock-list-subclass.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Jochen Sprickerhof -Date: Thu, 15 Dec 2022 07:44:54 +0100 -Subject: Don't mock list subclass - ---- - tests/unit/ec2/test_volume.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/unit/ec2/test_volume.py b/tests/unit/ec2/test_volume.py -index 81d7f55..d4d8e4f 100644 ---- a/tests/unit/ec2/test_volume.py -+++ b/tests/unit/ec2/test_volume.py -@@ -55,7 +55,7 @@ class VolumeTests(unittest.TestCase): - @mock.patch("boto.resultset.ResultSet") - def test_startElement_with_name_tagSet_calls_ResultSet(self, ResultSet, startElement): - startElement.return_value = None -- result_set = mock.Mock(ResultSet([("item", Tag)])) -+ result_set = ResultSet([("item", Tag)]) - volume = Volume() - volume.tags = result_set - retval = volume.startElement("tagSet", None, None) diff --git a/pkgs/development/python-modules/boto/bug-953970_python3.8-compat.patch b/pkgs/development/python-modules/boto/bug-953970_python3.8-compat.patch deleted file mode 100644 index ac5621042375..000000000000 --- a/pkgs/development/python-modules/boto/bug-953970_python3.8-compat.patch +++ /dev/null @@ -1,53 +0,0 @@ -Index: python-boto/tests/unit/utils/test_utils.py -=================================================================== ---- python-boto.orig/tests/unit/utils/test_utils.py -+++ python-boto/tests/unit/utils/test_utils.py -@@ -85,7 +85,7 @@ class TestPassword(unittest.TestCase): - def hmac_hashfunc(cls, msg): - if not isinstance(msg, bytes): - msg = msg.encode('utf-8') -- return hmac.new(b'mysecretkey', msg) -+ return hmac.new(b'mysecretkey', msg, digestmod='sha256') - - class HMACPassword(Password): - hashfunc = hmac_hashfunc -@@ -95,15 +95,15 @@ class TestPassword(unittest.TestCase): - password.set('foo') - - self.assertEquals(str(password), -- hmac.new(b'mysecretkey', b'foo').hexdigest()) -+ hmac.new(b'mysecretkey', b'foo', digestmod='sha256').hexdigest()) - - def test_constructor(self): -- hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg) -+ hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg, digestmod='sha256') - - password = Password(hashfunc=hmac_hashfunc) - password.set('foo') - self.assertEquals(password.str, -- hmac.new(b'mysecretkey', b'foo').hexdigest()) -+ hmac.new(b'mysecretkey', b'foo', digestmod='sha256').hexdigest()) - - - class TestPythonizeName(unittest.TestCase): -Index: python-boto/boto/ecs/item.py -=================================================================== ---- python-boto.orig/boto/ecs/item.py -+++ python-boto/boto/ecs/item.py -@@ -22,6 +22,7 @@ - - import xml.sax - import cgi -+from html import escape - from boto.compat import six, StringIO - - class ResponseGroup(xml.sax.ContentHandler): -@@ -67,7 +68,7 @@ class ResponseGroup(xml.sax.ContentHandl - return None - - def endElement(self, name, value, connection): -- self._xml.write("%s" % (cgi.escape(value).replace("&", "&"), name)) -+ self._xml.write("%s" % (escape(value).replace("&", "&"), name)) - if len(self._nodepath) == 0: - return - obj = None diff --git a/pkgs/development/python-modules/boto/default.nix b/pkgs/development/python-modules/boto/default.nix deleted file mode 100644 index 3549c6986cf1..000000000000 --- a/pkgs/development/python-modules/boto/default.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - lib, - buildPythonPackage, - fetchPypi, - python, - nose, - mock, - requests, - httpretty, -}: - -buildPythonPackage rec { - pname = "boto"; - version = "2.49.0"; - format = "setuptools"; - - src = fetchPypi { - inherit pname version; - sha256 = "ea0d3b40a2d852767be77ca343b58a9e3a4b00d9db440efb8da74b4e58025e5a"; - }; - - patches = [ - # fixes hmac tests - # https://sources.debian.org/src/python-boto/2.49.0-4/debian/patches/bug-953970_python3.8-compat.patch/ - ./bug-953970_python3.8-compat.patch - # fixes test_startElement_with_name_tagSet_calls_ResultSet - # https://sources.debian.org/src/python-boto/2.49.0-4.1/debian/patches/0005-Don-t-mock-list-subclass.patch/ - ./0005-Don-t-mock-list-subclass.patch - ]; - - # boto is deprecated by upstream as of 2021-05-27 (https://github.com/boto/boto/commit/4980ac58764c3d401cb0b9552101f9c61c18f445) - # this patch is a bit simpler than https://github.com/boto/boto/pull/3898 - # as we don't have to take care of pythonOlder "3.3". - postPatch = '' - substituteInPlace boto/dynamodb/types.py --replace 'from collections import Mapping' 'from collections.abc import Mapping' - substituteInPlace boto/mws/connection.py --replace 'import collections' 'import collections.abc as collections' - ''; - - checkPhase = '' - ${python.interpreter} tests/test.py default - ''; - - nativeCheckInputs = [ - nose - mock - ]; - propagatedBuildInputs = [ - requests - httpretty - ]; - - meta = with lib; { - homepage = "https://github.com/boto/boto"; - license = licenses.mit; - description = "Python interface to Amazon Web Services"; - longDescription = '' - The boto module is an integrated interface to current and - future infrastructural services offered by Amazon Web - Services. This includes S3, SQS, EC2, among others. - ''; - maintainers = [ ]; - # Unmaintained since 2020, archived in the beginning of May 2024 and broken - # https://github.com/boto/boto/issues/3951 - broken = true; - }; -} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index f5bd7a1e5d3a..e78e763003d7 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -75,6 +75,7 @@ mapAliases ({ bitcoin-price-api = throw "bitcoin-price-api has been removed, it was using setuptools 2to3 translation feautre, which has been removed in setuptools 58"; # added 2022-02-15 BlinkStick = blinkstick; # added 2023-02-19 blockdiagcontrib-cisco = throw "blockdiagcontrib-cisco is not compatible with blockdiag 2.0.0 and has been removed."; # added 2020-11-29 + boto = throw "boto was removed as it is deprecated upstream, had not been updated since 2018, and failed to build; please use boto3 and botocore"; # Added 2024-09-22 bsblan = python-bsblan; # added 2022-11-04 btchip = btchip-python; # added 2023-03-03 buildbot = throw "use pkgs.buildbot instead"; # added 2022-04-07 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ade493e873de..78429d458400 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1790,8 +1790,6 @@ self: super: with self; { boto3-stubs = callPackage ../development/python-modules/boto3-stubs { }; - boto = callPackage ../development/python-modules/boto { }; - botocore = callPackage ../development/python-modules/botocore { }; botocore-stubs = callPackage ../development/python-modules/botocore-stubs { };