[packages/python-boto] - added Fedora patches + fixes for collections.abc moves in python 3.10; release 6

qboosh qboosh at pld-linux.org
Sun Oct 22 19:48:05 CEST 2023


commit dcea9012ce563d5872a4eeb950c6c0c44fdaeb10
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Oct 22 19:50:02 2023 +0200

    - added Fedora patches + fixes for collections.abc moves in python 3.10; release 6

 boto-aws-exec-read.patch           |  13 ++
 boto-devendor.patch                |  54 +++++++
 boto-instance-attributes.patch     |  91 +++++++++++
 boto-modifysubnetattribute.patch   |  73 +++++++++
 boto-multi-vpc-zone.patch          |  72 +++++++++
 boto-nat-gateway.patch             | 319 +++++++++++++++++++++++++++++++++++++
 boto-retry-float.patch             |  13 ++
 boto-route53-no-resourcepath.patch |  41 +++++
 boto-s3-requestlog.patch           |  13 ++
 python-boto-py3.patch              |  46 ++++++
 python-boto.spec                   |  39 ++++-
 11 files changed, 769 insertions(+), 5 deletions(-)
---
diff --git a/python-boto.spec b/python-boto.spec
index 2e05124..76f568c 100644
--- a/python-boto.spec
+++ b/python-boto.spec
@@ -10,7 +10,7 @@ Summary:	An integrated interface to infrastructural services offered by Amazon W
 Summary(pl.UTF-8):	Zintegrowany interfejs do usług infrastruktury oferowanych przez usługi WWW Amazon
 Name:		python-%{module}
 Version:	2.49.0
-Release:	5
+Release:	6
 License:	MIT
 Group:		Libraries/Python
 #Source0Download: https://pypi.org/simple/boto/
@@ -18,6 +18,26 @@ Source0:	https://files.pythonhosted.org/packages/source/b/boto/boto-%{version}.t
 # Source0-md5:	e9b79f80198da059d9a8055a5352fd6d
 Patch0:		%{name}-mock.patch
 Patch1:		%{name}-py3.patch
+# https://github.com/boto/boto/pull/3086 (unbundle six)
+Patch2:		boto-devendor.patch
+# https://github.com/boto/boto/pull/3472
+Patch3:		boto-nat-gateway.patch
+# https://github.com/boto/boto/pull/3506
+# https://github.com/boto/boto/pull/3508
+Patch4:		boto-retry-float.patch
+# https://github.com/boto/boto/pull/3332
+Patch5:		boto-aws-exec-read.patch
+# https://github.com/boto/boto/pull/3077
+# https://github.com/boto/boto/pull/3131
+Patch6:		boto-instance-attributes.patch
+# https://github.com/boto/boto/pull/2882
+Patch7:		boto-multi-vpc-zone.patch
+# https://github.com/boto/boto/pull/2875
+Patch8:		boto-s3-requestlog.patch
+# https://github.com/boto/boto/pull/2866
+Patch9:		boto-route53-no-resourcepath.patch
+# https://github.com/boto/boto/pull/3111
+Patch10:	boto-modifysubnetattribute.patch
 URL:		https://github.com/boto/boto
 %if %{with python2}
 BuildRequires:	python-modules >= 1:2.6
@@ -105,18 +125,27 @@ Dokumentacja API modułu Pythona boto.
 %setup -q -n %{module}-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
-%if %{with python3}
-%py3_build
+%if %{with python2}
+%py_build
 
 %if %{with tests}
 nosetests-%{py_ver} tests/unit -a '!notdefault'
 %endif
 %endif
 
-%if %{with python2}
-%py_build
+%if %{with python3}
+%py3_build
 
 %if %{with tests}
 nosetests-%{py3_ver} tests/unit -a '!notdefault'
diff --git a/boto-aws-exec-read.patch b/boto-aws-exec-read.patch
new file mode 100644
index 0000000..39b0a8f
--- /dev/null
+++ b/boto-aws-exec-read.patch
@@ -0,0 +1,13 @@
+Index: boto-2.40.0/boto/s3/acl.py
+===================================================================
+--- boto-2.40.0.orig/boto/s3/acl.py
++++ boto-2.40.0/boto/s3/acl.py
+@@ -25,7 +25,7 @@ from boto.s3.user import User
+ CannedACLStrings = ['private', 'public-read',
+                     'public-read-write', 'authenticated-read',
+                     'bucket-owner-read', 'bucket-owner-full-control',
+-                    'log-delivery-write']
++                    'log-delivery-write', 'aws-exec-read']
+ 
+ 
+ class Policy(object):
diff --git a/boto-devendor.patch b/boto-devendor.patch
new file mode 100644
index 0000000..209e1fe
--- /dev/null
+++ b/boto-devendor.patch
@@ -0,0 +1,54 @@
+Index: boto-2.39.0/boto/compat.py
+===================================================================
+--- boto-2.39.0.orig/boto/compat.py
++++ boto-2.39.0/boto/compat.py
+@@ -46,16 +46,27 @@ except (AttributeError, ImportError):
+     # This is probably running on App Engine.
+     expanduser = (lambda x: x)
+ 
+-from boto.vendored import six
++try:
++    import six
++    from six import BytesIO, StringIO
++    from six.moves import filter, http_client, map, _thread, \
++                          urllib, zip
++    from six.moves.queue import Queue
++    from six.moves.urllib.parse import parse_qs, quote, unquote, \
++                                       urlparse, urlsplit
++    from six.moves.urllib.parse import unquote_plus
++    from six.moves.urllib.request import urlopen
++except ImportError:
++    from boto.vendored import six
+ 
+-from boto.vendored.six import BytesIO, StringIO
+-from boto.vendored.six.moves import filter, http_client, map, _thread, \
+-                                    urllib, zip
+-from boto.vendored.six.moves.queue import Queue
+-from boto.vendored.six.moves.urllib.parse import parse_qs, quote, unquote, \
+-                                                 urlparse, urlsplit
+-from boto.vendored.six.moves.urllib.parse import unquote_plus
+-from boto.vendored.six.moves.urllib.request import urlopen
++    from boto.vendored.six import BytesIO, StringIO
++    from boto.vendored.six.moves import filter, http_client, map, _thread, \
++                                        urllib, zip
++    from boto.vendored.six.moves.queue import Queue
++    from boto.vendored.six.moves.urllib.parse import parse_qs, quote, unquote, \
++                                                     urlparse, urlsplit
++    from boto.vendored.six.moves.urllib.parse import unquote_plus
++    from boto.vendored.six.moves.urllib.request import urlopen
+ 
+ if six.PY3:
+     # StandardError was removed, so use the base exception type instead
+Index: boto-2.39.0/setup.py
+===================================================================
+--- boto-2.39.0.orig/setup.py
++++ boto-2.39.0/setup.py
+@@ -76,7 +76,7 @@ setup(name = "boto",
+                   "boto.elastictranscoder", "boto.opsworks", "boto.redshift",
+                   "boto.dynamodb2", "boto.support", "boto.cloudtrail",
+                   "boto.directconnect", "boto.kinesis", "boto.rds2",
+-                  "boto.cloudsearch2", "boto.logs", "boto.vendored",
++                  "boto.cloudsearch2", "boto.logs",
+                   "boto.route53.domains", "boto.cognito",
+                   "boto.cognito.identity", "boto.cognito.sync",
+                   "boto.cloudsearchdomain", "boto.kms",
diff --git a/boto-instance-attributes.patch b/boto-instance-attributes.patch
new file mode 100644
index 0000000..4f9182e
--- /dev/null
+++ b/boto-instance-attributes.patch
@@ -0,0 +1,91 @@
+Index: boto-2.40.0/boto/ec2/instance.py
+===================================================================
+--- boto-2.40.0.orig/boto/ec2/instance.py
++++ boto-2.40.0/boto/ec2/instance.py
+@@ -631,7 +631,8 @@ class InstanceAttribute(dict):
+                    'disableApiTermination',
+                    'instanceInitiatedShutdownBehavior',
+                    'rootDeviceName', 'blockDeviceMapping', 'sourceDestCheck',
+-                   'groupSet']
++                   'groupSet', 'productCodes', 'ebsOptimized',
++                   'sriovNetSupport']
+ 
+     def __init__(self, parent=None):
+         dict.__init__(self)
+Index: boto-2.40.0/tests/unit/ec2/test_attribute.py
+===================================================================
+--- /dev/null
++++ boto-2.40.0/tests/unit/ec2/test_attribute.py
+@@ -0,0 +1,72 @@
++from tests.unit import unittest
++from tests.compat import mock
++
++from boto.ec2.connection import EC2Connection, Instance
++
++ATTRIBUTE_GET_TRUE_EBSOPTIMIZED_RESPONSE = b"""
++<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
++  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
++  <instanceId>i-10a64379</instanceId>
++  <ebsOptimized>
++    <value>true</value>
++  </ebsOptimized>
++</DescribeInstanceAttributeResponse>
++"""
++
++ATTRIBUTE_GET_FALSE_EBSOPTIMIZED_RESPONSE = b"""
++<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
++  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
++  <instanceId>i-10a64379</instanceId>
++  <ebsOptimized>
++    <value>false</value>
++  </ebsOptimized>
++</DescribeInstanceAttributeResponse>
++"""
++
++ATTRIBUTE_GET_EMPTY_PRODUCTCODES_RESPONSE = b"""
++<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
++  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
++  <instanceId>i-10a64379</instanceId>
++  <productCodes/>
++</DescribeInstanceAttributeResponse>
++"""
++
++# Tests to be run on an InstanceAttributes
++# Format:
++# (EC2_RESPONSE_STRING, (string_of_attribute_to_test, value) )
++ATTRIBUTE_TESTS = [
++    (ATTRIBUTE_GET_TRUE_EBSOPTIMIZED_RESPONSE,
++     ('ebsOptimized', True)),
++    (ATTRIBUTE_GET_FALSE_EBSOPTIMIZED_RESPONSE,
++     ('ebsOptimized', False)),
++    (ATTRIBUTE_GET_EMPTY_PRODUCTCODES_RESPONSE,
++     ('productCodes', None)),
++]
++
++
++class TestInstanceAttributes(unittest.TestCase):
++    """Tests Instance Attributes."""
++    def _setup_mock(self):
++        """Sets up a mock ec2 request.
++        Returns: response, ec2 connection and Instance
++        """
++        mock_response = mock.Mock()
++        mock_response.status = 200
++        ec2 = EC2Connection(aws_access_key_id='aws_access_key_id',
++                            aws_secret_access_key='aws_secret_access_key')
++        ec2.make_request = mock.Mock(return_value=mock_response)
++        return mock_response, ec2, Instance(ec2)
++
++    def test_instance_get_attributes(self):
++        """Tests the InstanceAttributes from the EC2 object."""
++        mock_response, _, instance = self._setup_mock()
++
++        for response, attr_test in ATTRIBUTE_TESTS:
++            mock_response.read.return_value = response
++            expected_value = dict([attr_test])
++            actual_value = instance.get_attribute(attr_test[0])
++            self.assertEqual(expected_value, actual_value)
++
++
++if __name__ == '__main__':
++    unittest.main()
diff --git a/boto-modifysubnetattribute.patch b/boto-modifysubnetattribute.patch
new file mode 100644
index 0000000..705fe37
--- /dev/null
+++ b/boto-modifysubnetattribute.patch
@@ -0,0 +1,73 @@
+Index: boto-2.45.0/boto/vpc/__init__.py
+===================================================================
+--- boto-2.45.0.orig/boto/vpc/__init__.py
++++ boto-2.45.0/boto/vpc/__init__.py
+@@ -1269,6 +1269,33 @@ class VPCConnection(EC2Connection):
+             params['DryRun'] = 'true'
+         return self.get_status('DeleteSubnet', params)
+ 
++    def modify_subnet_attribute(self, subnet_id, map_public_ip_on_launch,
++                                dry_run=False):
++        """
++        :type subnet_id: str
++        :param subnet_id: The ID of the subnet.
++
++        :type map_public_ip_on_launch: bool
++        :param map_public_ip_on_launch: Specifies whether public IP addresses
++               are provided for the instances launched into this subnet.
++
++        :type dry_run: bool
++        :param dry_run: Set to True if the operation should not actually run.
++
++        :rtype: bool
++        :return: True if successful
++        """
++        params = {
++            'SubnetId': subnet_id
++        }
++
++        params['MapPublicIpOnLaunch.Value'] = (
++                'true' if map_public_ip_on_launch else 'false')
++
++        if dry_run:
++            params['DryRun'] = 'true'
++        return self.get_status('ModifySubnetAttribute', params)
++
+     # DHCP Options
+ 
+     def get_all_dhcp_options(self, dhcp_options_ids=None, filters=None, dry_run=False):
+Index: boto-2.45.0/tests/unit/vpc/test_subnet.py
+===================================================================
+--- boto-2.45.0.orig/tests/unit/vpc/test_subnet.py
++++ boto-2.45.0/tests/unit/vpc/test_subnet.py
+@@ -129,5 +129,30 @@ class TestDeleteSubnet(AWSMockServiceTes
+         self.assertEquals(api_response, True)
+ 
+ 
++class TestModifySubnetAttribute(AWSMockServiceTestCase):
++
++    connection_class = VPCConnection
++
++    def default_body(self):
++        return b"""
++            <ModifySubnetAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-01/">
++               <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
++               <return>true</return>
++            </ModifySubnetAttributeResponse>
++        """
++
++    def test_modify_subnet_attribute(self):
++        self.set_http_response(status_code=200)
++        api_response = self.service_connection.modify_subnet_attribute('subnet-a605r929',
++                                                                       True)
++        self.assert_request_parameters({
++            'Action': 'ModifySubnetAttribute',
++            'SubnetId': 'subnet-a605r929', 'MapPublicIpOnLaunch.Value': 'true'},
++            ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
++                                  'SignatureVersion', 'Timestamp',
++                                  'Version'])
++        self.assertEquals(api_response, True)
++
++
+ if __name__ == '__main__':
+     unittest.main()
diff --git a/boto-multi-vpc-zone.patch b/boto-multi-vpc-zone.patch
new file mode 100644
index 0000000..90c9b40
--- /dev/null
+++ b/boto-multi-vpc-zone.patch
@@ -0,0 +1,72 @@
+Index: boto-2.40.0/boto/route53/connection.py
+===================================================================
+--- boto-2.40.0.orig/boto/route53/connection.py
++++ boto-2.40.0/boto/route53/connection.py
+@@ -152,8 +152,8 @@ class Route53Connection(AWSAuthConnectio
+             raise exception.DNSServerError(response.status,
+                                            response.reason,
+                                            body)
+-        e = boto.jsonresponse.Element(list_marker='NameServers',
+-                                      item_marker=('NameServer',))
++        e = boto.jsonresponse.Element(list_marker=('NameServers', 'VPCs'),
++                                      item_marker=('NameServer', 'VPC'))
+         h = boto.jsonresponse.XmlHandler(e, None)
+         h.parse(body)
+         return e
+Index: boto-2.40.0/tests/integration/route53/test_zone.py
+===================================================================
+--- boto-2.40.0.orig/tests/integration/route53/test_zone.py
++++ boto-2.40.0/tests/integration/route53/test_zone.py
+@@ -186,6 +186,12 @@ class TestRoute53PrivateZone(unittest.Te
+                                                     vpc_id=self.test_vpc.id,
+                                                     vpc_region='us-east-1')
+ 
++    def test_get_hosted_zone_for_private_zone(self):
++        self.get_hosted_zone = self.route53.get_hosted_zone_by_name(self.base_domain)
++        self.assertEquals(len(self.get_hosted_zone['GetHostedZoneResponse']['VPCs']), 1)
++        self.assertEquals(self.get_hosted_zone['GetHostedZoneResponse']['VPCs'][0]['VPCRegion'], 'us-east-1')
++        self.assertEquals(self.get_hosted_zone['GetHostedZoneResponse']['VPCs'][0]['VPCId'], self.test_vpc.id)
++
+     @classmethod
+     def tearDownClass(self):
+         if self.zone is not None:
+Index: boto-2.40.0/tests/unit/route53/test_connection.py
+===================================================================
+--- boto-2.40.0.orig/tests/unit/route53/test_connection.py
++++ boto-2.40.0/tests/unit/route53/test_connection.py
+@@ -313,6 +313,16 @@ class TestGetHostedZoneRoute53(AWSMockSe
+             <NameServer>ns-1000.awsdns-00.co.uk</NameServer>
+         </NameServers>
+     </DelegationSet>
++    <VPCs>
++        <VPC>
++            <VPCRegion>eu-west-1</VPCRegion>
++            <VPCId>vpc-12345</VPCId>
++        </VPC>
++        <VPC>
++            <VPCRegion>us-west-1</VPCRegion>
++            <VPCId>vpc-78900</VPCId>
++        </VPC>
++   </VPCs>
+ </GetHostedZoneResponse>
+ """
+ 
+@@ -330,6 +340,18 @@ class TestGetHostedZoneRoute53(AWSMockSe
+                                  ['DelegationSet']['NameServers'],
+                          ['ns-1000.awsdns-40.org', 'ns-200.awsdns-30.com',
+                           'ns-900.awsdns-50.net', 'ns-1000.awsdns-00.co.uk'])
++        self.assertEqual(response['GetHostedZoneResponse']
++                                 ['VPCs'][0]['VPCRegion'],
++                         'eu-west-1')
++        self.assertEqual(response['GetHostedZoneResponse']
++                                 ['VPCs'][0]['VPCId'],
++                         'vpc-12345')
++        self.assertEqual(response['GetHostedZoneResponse']
++                                 ['VPCs'][1]['VPCRegion'],
++                         'us-west-1')
++        self.assertEqual(response['GetHostedZoneResponse']
++                                 ['VPCs'][1]['VPCId'],
++                         'vpc-78900')
+ 
+ 
+ @attr(route53=True)
diff --git a/boto-nat-gateway.patch b/boto-nat-gateway.patch
new file mode 100644
index 0000000..5ff9d76
--- /dev/null
+++ b/boto-nat-gateway.patch
@@ -0,0 +1,319 @@
+Index: boto-2.40.0/boto/vpc/__init__.py
+===================================================================
+--- boto-2.40.0.orig/boto/vpc/__init__.py
++++ boto-2.40.0/boto/vpc/__init__.py
+@@ -29,6 +29,7 @@ from boto.vpc.vpc import VPC
+ from boto.vpc.customergateway import CustomerGateway
+ from boto.vpc.networkacl import NetworkAcl
+ from boto.vpc.routetable import RouteTable
++from boto.vpc.natgateway import NatGateway
+ from boto.vpc.internetgateway import InternetGateway
+ from boto.vpc.vpngateway import VpnGateway, Attachment
+ from boto.vpc.dhcpoptions import DhcpOptions
+@@ -783,6 +784,76 @@ class VPCConnection(EC2Connection):
+ 
+         return self.get_status('DeleteNetworkAclEntry', params)
+ 
++    # NAT Gateways
++
++    def get_all_nat_gateways(self, nat_gateway_ids=None, filters=None, dry_run=False):
++        """
++        Get a list of NAT gateways. You can filter results to return information
++        about only those gateways that you're interested in.
++
++        :type nat_gateway_ids: list
++        :param nat_gateway_ids: A list of strings with the desired gateway IDs.
++
++        :type filters: list of tuples or dict
++        :param filters: A list of tuples or dict containing filters.  Each tuple
++                        or dict item consists of a filter key and a filter value.
++
++        :type dry_run: bool
++        :param dry_run: Set to True if the operation should not actually run.
++
++        """
++        params = {}
++
++        if nat_gateway_ids:
++            self.build_list_params(params, nat_gateway_ids,
++                                   'NatGatewayId')
++        if filters:
++            self.build_filter_params(params, filters)
++        if dry_run:
++            params['DryRun'] = 'true'
++        return self.get_list('DescribeNatGateways', params,
++                             [('item', NatGateway)])
++
++    def create_nat_gateway(self, subnet_id, allocation_id, dry_run=False):
++        """
++        Creates a NAT gateway for VPC.
++
++        :type subnet_id: str
++        :param subnet_id: The subnet in which the NAT gateway should be launched.
++
++        :type allocation_id: str
++        :param allocation_id: The allocation ID of an elastic IP address for the public side of the gateway.
++
++        :type dry_run: bool
++        :param dry_run: Set to True if the operation should not actually run.
++
++        :rtype: Newly created nat gateway.
++        :return: `boto.vpc.natgateway.NATGateway`
++        """
++        params = {'SubnetId': subnet_id,
++                  'AllocationId': allocation_id}
++        if dry_run:
++            params['DryRun'] = 'true'
++        return self.get_object('CreateNatGateway', params, NatGateway)
++
++    def delete_nat_gateway(self, nat_gateway_id, dry_run=False):
++        """
++        Deletes a NAT gateway from the VPC.
++
++        :type nat_gateway_id: str
++        :param nat_gateway_id: The ID of the NAT gateway to delete.
++
++        :type dry_run: bool
++        :param dry_run: Set to True if the operation should not actually run.
++
++        :rtype: Bool
++        :return: True if successful
++        """
++        params = {'NatGatewayId': nat_gateway_id}
++        if dry_run:
++            params['DryRun'] = 'true'
++        return self.get_status('DeleteNatGateway', params)
++
+     # Internet Gateways
+ 
+     def get_all_internet_gateways(self, internet_gateway_ids=None,
+Index: boto-2.40.0/boto/vpc/natgateway.py
+===================================================================
+--- /dev/null
++++ boto-2.40.0/boto/vpc/natgateway.py
+@@ -0,0 +1,89 @@
++# Copyright (c) 2009-2010 Mitch Garnaat http://garnaat.org/
++#
++# Permission is hereby granted, free of charge, to any person obtaining a
++# copy of this software and associated documentation files (the
++# "Software"), to deal in the Software without restriction, including
++# without limitation the rights to use, copy, modify, merge, publish, dis-
++# tribute, sublicense, and/or sell copies of the Software, and to permit
++# persons to whom the Software is furnished to do so, subject to the fol-
++# lowing conditions:
++#
++# The above copyright notice and this permission notice shall be included
++# in all copies or substantial portions of the Software.
++#
++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
++# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
++# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
++# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
++# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
++# IN THE SOFTWARE.
++
++"""
++Represents a NAT Gateway
++"""
++
++from boto.ec2.ec2object import TaggedEC2Object
++from boto.resultset import ResultSet
++
++
++class NatGateway(TaggedEC2Object):
++    def __init__(self, connection=None):
++        super(NatGateway, self).__init__(connection)
++        self.id = None
++        self.vpc_id = None
++        self.subnet_id = None
++        self.state = None
++        self.addresses = []
++
++    def __repr__(self):
++        return 'NatGateway:%s' % self.id
++
++    def startElement(self, name, attrs, connection):
++        result = super(NatGateway, self).startElement(name, attrs, connection)
++
++        if result is not None:
++            # Parent found an interested element, just return it
++            return result
++
++        if name == 'natGatewayAddressSet':
++            self.addresses = ResultSet([('item', NatGatewayAddress)])
++            return self.addresses
++        else:
++            return None
++
++    def endElement(self, name, value, connection):
++        if name == 'natGatewayId':
++            self.id = value
++        elif name == 'vpcId':
++            self.vpc_id = value
++        elif name == 'subnetId':
++            self.subnet_id = value
++        elif name == 'state':
++            self.state = value
++        else:
++            setattr(self, name, value)
++
++
++class NatGatewayAddress(object):
++    def __init__(self, connection=None):
++        self.interface_id = None
++        self.allocation_id = None
++        self.ip_public = None
++        self.ip_private = None
++
++    def __repr__(self):
++        return 'NatGatewayAddress:%s' % self.interface_id
++
++    def startElement(self, name, attrs, connection):
++        return None
++
++    def endElement(self, name, value, connection):
++        if name == 'networkInterfaceId':
++            self.interface_id = value
++        elif name == 'publicIp':
++            self.ip_public = value
++        elif name == 'allocationId':
++            self.allocation_id = value
++        elif name == 'privateIp':
++            self.ip_private = value
+Index: boto-2.40.0/docs/source/ref/vpc.rst
+===================================================================
+--- boto-2.40.0.orig/docs/source/ref/vpc.rst
++++ boto-2.40.0/docs/source/ref/vpc.rst
+@@ -32,6 +32,13 @@ boto.vpc.internetgateway
+    :members:   
+    :undoc-members:
+ 
++boto.vpc.natgateway
++-------------------
++
++.. automodule:: boto.vpc.natgateway
++   :members:
++   :undoc-members:
++
+ boto.vpc.routetable
+ -------------------
+ 
+Index: boto-2.40.0/tests/unit/vpc/test_natgateway.py
+===================================================================
+--- /dev/null
++++ boto-2.40.0/tests/unit/vpc/test_natgateway.py
+@@ -0,0 +1,113 @@
++from tests.unit import unittest
++from tests.unit import AWSMockServiceTestCase
++
++from boto.vpc import VPCConnection, NatGateway
++
++
++class TestDescribeNatGateway(AWSMockServiceTestCase):
++
++    connection_class = VPCConnection
++
++    def default_body(self):
++        return b"""
++            <DescribeNatGatewaysResponse xmlns="http://ec2.amazonaws.com/doc/2015-10-01/">
++                <requestId>bfed02c6-dae9-47c0-86a2-example</requestId>
++                <natGatewaySet>
++                     <item>
++                        <subnetId>subnet-1a2a3a4a</subnetId>
++                        <natGatewayAddressSet>
++                            <item>
++                                <networkInterfaceId>eni-00e37850</networkInterfaceId>
++                                <publicIp>198.18.125.129</publicIp>
++                                <allocationId>eipalloc-37fc1a52</allocationId>
++                                <privateIp>10.0.2.147</privateIp>
++                            </item>
++                        </natGatewayAddressSet>
++                        <createTime>2015-11-25T14:00:55.416Z</createTime>
++                        <vpcId>vpc-4e20d42b</vpcId>
++                        <natGatewayId>nat-04e77a5e9c34432f9</natGatewayId>
++                        <state>available</state>
++                    </item>
++                </natGatewaySet>
++            </DescribeNatGatewaysResponse>
++        """
++
++    def test_describe_nat_gateway(self):
++        self.set_http_response(status_code=200)
++        api_response = self.service_connection.get_all_nat_gateways(
++            'nat-04e77a5e9c34432f9', filters=[('natGatewayAddress.allocationId', ['eipalloc-37fc1a52'])])
++        self.assert_request_parameters({
++            'Action': 'DescribeNatGateways',
++            'NatGatewayId.1': 'nat-04e77a5e9c34432f9',
++            'Filter.1.Name': 'natGatewayAddress.allocationId',
++            'Filter.1.Value.1': 'eipalloc-37fc1a52'},
++            ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
++                                  'SignatureVersion', 'Timestamp',
++                                  'Version'])
++        self.assertEquals(len(api_response), 1)
++        self.assertIsInstance(api_response[0], NatGateway)
++        self.assertEqual(api_response[0].id, 'nat-04e77a5e9c34432f9')
++
++
++class TestCreateNatGateway(AWSMockServiceTestCase):
++
++    connection_class = VPCConnection
++
++    def default_body(self):
++        return b"""
++            <CreateNatGatewayResponse xmlns="http://ec2.amazonaws.com/doc/2015-10-01/">
++                <requestId>1b74dc5c-bcda-403f-867d-example</requestId>
++                <natGateway>
++                    <subnetId>subnet-1a2b3c4d</subnetId>
++                    <natGatewayAddressSet>
++                        <item>
++                            <allocationId>eipalloc-37fc1a52</allocationId>
++                        </item>
++                    </natGatewayAddressSet>
++                    <createTime>2015-11-25T14:00:55.416Z</createTime>
++                    <vpcId>vpc-4e20d42b</vpcId>
++                    <natGatewayId>nat-04e77a5e9c34432f9</natGatewayId>
++                    <state>pending</state>
++                </natGateway>
++            </CreateNatGatewayResponse>
++        """
++
++    def test_create_nat_gateway(self):
++        self.set_http_response(status_code=200)
++        api_response = self.service_connection.create_nat_gateway('subnet-1a2b3c4d', 'eipalloc-37fc1a52')
++        self.assert_request_parameters({
++            'Action': 'CreateNatGateway',
++            'SubnetId': 'subnet-1a2b3c4d',
++            'AllocationId': 'eipalloc-37fc1a52'},
++            ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
++                                  'SignatureVersion', 'Timestamp',
++                                  'Version'])
++        self.assertIsInstance(api_response, NatGateway)
++        self.assertEqual(api_response.id, 'nat-04e77a5e9c34432f9')
++
++
++class TestDeleteNatGateway(AWSMockServiceTestCase):
++
++    connection_class = VPCConnection
++
++    def default_body(self):
++        return b"""
++            <DeleteNatGatewayResponse xmlns="http://ec2.amazonaws.com/doc/2015-10-01/">
++                <requestId>741fc8ab-6ebe-452b-b92b-example</requestId>
++                <natGatewayId>nat-04ae55e711cec5680</natGatewayId>
++            </DeleteNatGatewayResponse>
++        """
++
++    def test_delete_nat_gateway(self):
++        self.set_http_response(status_code=200)
++        api_response = self.service_connection.delete_nat_gateway('nat-04ae55e711cec5680')
++        self.assert_request_parameters({
++            'Action': 'DeleteNatGateway',
++            'NatGatewayId': 'nat-04ae55e711cec5680'},
++            ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
++                                  'SignatureVersion', 'Timestamp',
++                                  'Version'])
++        self.assertEquals(api_response, True)
++
++if __name__ == '__main__':
++    unittest.main()
diff --git a/boto-retry-float.patch b/boto-retry-float.patch
new file mode 100644
index 0000000..6fd1002
--- /dev/null
+++ b/boto-retry-float.patch
@@ -0,0 +1,13 @@
+Index: boto-2.40.0/boto/connection.py
+===================================================================
+--- boto-2.40.0.orig/boto/connection.py
++++ boto-2.40.0/boto/connection.py
+@@ -920,7 +920,7 @@ class AWSAuthConnection(object):
+         while i <= num_retries:
+             # Use binary exponential backoff to desynchronize client requests.
+             next_sleep = min(random.random() * (2 ** i),
+-                             boto.config.get('Boto', 'max_retry_delay', 60))
++                             boto.config.getfloat('Boto', 'max_retry_delay', 60))
+             try:
+                 # we now re-sign each request before it is retried
+                 boto.log.debug('Token: %s' % self.provider.security_token)
diff --git a/boto-route53-no-resourcepath.patch b/boto-route53-no-resourcepath.patch
new file mode 100644
index 0000000..38ac8b3
--- /dev/null
+++ b/boto-route53-no-resourcepath.patch
@@ -0,0 +1,41 @@
+Index: boto-2.40.0/boto/route53/healthcheck.py
+===================================================================
+--- boto-2.40.0.orig/boto/route53/healthcheck.py
++++ boto-2.40.0/boto/route53/healthcheck.py
+@@ -56,7 +56,7 @@ class HealthCheck(object):
+             %(ip_addr_part)s
+             <Port>%(port)s</Port>
+             <Type>%(type)s</Type>
+-            <ResourcePath>%(resource_path)s</ResourcePath>
++            %(resource_path)s
+             %(fqdn_part)s
+             %(string_match_part)s
+             %(request_interval)s
+@@ -72,6 +72,8 @@ class HealthCheck(object):
+ 
+     XMLRequestIntervalPart = """<RequestInterval>%(request_interval)d</RequestInterval>"""
+ 
++    XMLResourcePath = """<ResourcePath>%(resource_path)s</ResourcePath>"""
++
+     valid_request_intervals = (10, 30)
+ 
+     def __init__(self, ip_addr, port, hc_type, resource_path, fqdn=None, string_match=None, request_interval=30, failure_threshold=3):
+@@ -127,7 +129,7 @@ class HealthCheck(object):
+             'ip_addr_part': '',
+             'port': self.port,
+             'type': self.hc_type,
+-            'resource_path': self.resource_path,
++            'resource_path': "",
+             'fqdn_part': "",
+             'string_match_part': "",
+             'request_interval': (self.XMLRequestIntervalPart %
+@@ -140,6 +142,9 @@ class HealthCheck(object):
+         if self.ip_addr:
+             params['ip_addr_part'] = self.XMLIpAddrPart % {'ip_addr': self.ip_addr}
+ 
++        if self.resource_path is not None:
++            params['resource_path'] = self.XMLResourcePath % {'resource_path': self.resource_path}
++
+         if self.string_match is not None:
+             params['string_match_part'] = self.XMLStringMatchPart % {'string_match': self.string_match}
+ 
diff --git a/boto-s3-requestlog.patch b/boto-s3-requestlog.patch
new file mode 100644
index 0000000..5629bef
--- /dev/null
+++ b/boto-s3-requestlog.patch
@@ -0,0 +1,13 @@
+Index: boto-2.40.0/boto/requestlog.py
+===================================================================
+--- boto-2.40.0.orig/boto/requestlog.py
++++ boto-2.40.0/boto/requestlog.py
+@@ -25,7 +25,7 @@ class RequestLogger(RequestHook):
+         duration = (td.microseconds + long_type(td.seconds + td.days * 24 * 3600) * 1e6) / 1e6
+ 
+         # write output including timestamp, status code, response time, response size, request action
+-        self.request_log_queue.put("'%s', '%s', '%s', '%s', '%s'\n" % (time, response.status, duration, len, request.params['Action']))
++        self.request_log_queue.put("'%s', '%s', '%s', '%s', '%s'\n" % (time, response.status, duration, len, request.params.get('Action')))
+ 
+     def _request_log_worker(self):
+         while True:
diff --git a/python-boto-py3.patch b/python-boto-py3.patch
index f8cb36a..3d87105 100644
--- a/python-boto-py3.patch
+++ b/python-boto-py3.patch
@@ -51,3 +51,49 @@
          if len(self._nodepath) == 0:
              return
          obj = None
+--- boto-2.49.0/boto/dynamodb/types.py.orig	2018-07-11 19:35:36.000000000 +0200
++++ boto-2.49.0/boto/dynamodb/types.py	2023-10-22 19:38:05.007899677 +0200
+@@ -27,7 +27,7 @@ Python types and vice-versa.
+ import base64
+ from decimal import (Decimal, DecimalException, Context,
+                      Clamped, Overflow, Inexact, Underflow, Rounded)
+-from collections import Mapping
++from six.moves.collections_abc import Mapping
+ from boto.dynamodb.exceptions import DynamoDBNumberError
+ from boto.compat import filter, map, six, long_type
+ 
+--- boto-2.49.0/boto/mws/connection.py.orig	2018-07-11 19:35:36.000000000 +0200
++++ boto-2.49.0/boto/mws/connection.py	2023-10-22 19:44:26.409166783 +0200
+@@ -21,13 +21,13 @@
+ import xml.sax
+ import hashlib
+ import string
+-import collections
+ from boto.connection import AWSQueryConnection
+ from boto.exception import BotoServerError
+ import boto.mws.exception
+ import boto.mws.response
+ from boto.handler import XmlHandler
+ from boto.compat import filter, map, six, encodebytes
++from six.moves import collections_abc
+ 
+ __all__ = ['MWSConnection']
+ 
+@@ -109,7 +109,7 @@ def http_body(field):
+ def destructure_object(value, into, prefix, members=False):
+     if isinstance(value, boto.mws.response.ResponseElement):
+         destructure_object(value.__dict__, into, prefix, members=members)
+-    elif isinstance(value, collections.Mapping):
++    elif isinstance(value, collections_abc.Mapping):
+         for name in value:
+             if name.startswith('_'):
+                 continue
+@@ -117,7 +117,7 @@ def destructure_object(value, into, pref
+                                members=members)
+     elif isinstance(value, six.string_types):
+         into[prefix] = value
+-    elif isinstance(value, collections.Iterable):
++    elif isinstance(value, collections_abc.Iterable):
+         for index, element in enumerate(value):
+             suffix = (members and '.member.' or '.') + str(index + 1)
+             destructure_object(element, into, prefix + suffix,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-boto.git/commitdiff/dcea9012ce563d5872a4eeb950c6c0c44fdaeb10



More information about the pld-cvs-commit mailing list