[arch-commits] Commit in python-moto/trunk (2 files)

Chih-Hsuan Yen yan12125 at archlinux.org
Sat Feb 27 18:40:18 UTC 2021


    Date: Saturday, February 27, 2021 @ 18:40:18
  Author: yan12125
Revision: 875351

upgpkg: python-moto 2.0.0-1; major changes to dependencies following upstream

And use Podman to run tests

Modified:
  python-moto/trunk/PKGBUILD
Deleted:
  python-moto/trunk/python-moto-botocore-1.19.41.patch

------------------------------------+
 PKGBUILD                           |   87 ++++++++------------
 python-moto-botocore-1.19.41.patch |  149 -----------------------------------
 2 files changed, 35 insertions(+), 201 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-02-27 16:47:04 UTC (rev 875350)
+++ PKGBUILD	2021-02-27 18:40:18 UTC (rev 875351)
@@ -3,35 +3,41 @@
 
 pkgname=python-moto
 _pkgname=moto
-pkgver=1.3.16
-pkgrel=5
+pkgver=2.0.0
+pkgrel=1
 pkgdesc='Moto is a library to mock out the boto library.'
 arch=(any)
 url='https://github.com/spulec/moto'
 license=(Apache)
 # depends on python-setuptools as pkg_resources is used is several modules
-depends=(python-aws-xray-sdk python-boto python-boto3
-         python-cryptography python-dateutil python-docker python-jinja
-         python-jsondiff python-jose python-mock python-yaml
-         python-pytz python-requests python-responses python-xmltodict
-         python-werkzeug python-cfn-lint python-setuptools python-sshpubkeys)
-checkdepends=(python-flask python-freezegun python-nose python-parameterized
-              python-sure tk)
+# NOTE: Keep the order of dependencies matching setup.py
+depends=(python-boto3 python-botocore python-cryptography python-requests python-xmltodict
+         python-six python-werkzeug python-pytz python-dateutil python-responses
+         # Below dependencies varied with Python versions
+         python-jinja python-mock python-more-itertools python-setuptools python-zipp)
+# See reqquirements-test.txt, excluding pytest-cov
+checkdepends=(python-pytest python-sure python-freezegun
+              # boto is vendored (#3503), but still imported in tests
+              python-boto)
+# Below are optional dependencies. The order matches _dep_* items in upstream `setup.py`.
+# Note that _dep_python_jose_ecdsa_pin and _dep_idna are excluded as they are pins and
+# not used by moto.
 optdepends=(
+  'python-yaml: for cloudformation, s3 and ssm'
+  'python-jose: for apigateway and cognitoidp'
+  'python-docker: for awslambda, batch, cloudformation, dynamodb2, dynamodbstreams, ec2, ses, sns, sqs and ssm'
+  'python-jsondiff: for iotdata'
+  'python-aws-xray-sdk: for xray'
+  'python-cfn-lint: for cloudformation and ssm'
+  'python-sshpubkeys: for ec2'
   'python-flask: for moto_server'
+  'python-flask-cors: for moto_server'
 )
+checkdepends+=(python-yaml python-jose python-docker python-jsondiff python-aws-xray-sdk
+               python-cfn-lint python-sshpubkeys python-flask python-flask-cors)
 source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz"
-        "$pkgname-cfn-lint-0.39.patch::https://github.com/spulec/moto/commit/403b06d9c5d9fda4d9c51f44d5213cf584d7dc11.patch"
-        "$pkgname-boto3-1.14.59.patch::https://github.com/spulec/moto/commit/9f0f230d130a839fb2de6bfc97af4182360fbcdb.patch"
-        "$pkgname-responses-0.12.1.patch::https://github.com/spulec/moto/commit/7749c1f75781cd5fb2367b089c31a92e127b07b1.patch"
-        # Rebased from https://github.com/spulec/moto/commit/9ecea2012a19cf929f03271dddf5ce3e17943f48
-        "$pkgname-botocore-1.19.41.patch"
         sdist-no-pyc.diff)
-sha256sums=('6c686b1f117563391957ce47c2106bc3868783d59d0e004d2446dce875bec07f'
-            'afb3a13ccfe1646403e5727c812e26ab88106c212b735d5ab9a55879fcb34e43'
-            'f902d1b01c12e8a1b8e87109a984ab1463b60b04e1dbdeaa94550276d2580a11'
-            'cca3d8749c07eac50a17cff7b6dffdb9aa8d5ce9ca974453a63516d35cb2025a'
-            'af4505592277c795d2abdf8418c528c7ef3669282077654954307c9d1ab321ad'
+sha256sums=('d2edc6bdd8a9548c56e7fb73329bdd508ece1530d4b8a054426a8716d6ef35f2'
             '4193bd88380f6ab8dac49be37d940993dee4e31351ffd60c8167b7c8e5ec3208')
 
 prepare() {
@@ -39,15 +45,6 @@
 
   patch -Np1 -i ../sdist-no-pyc.diff
 
-  # https://github.com/spulec/moto/pull/3412
-  patch -Np1 -i ../$pkgname-cfn-lint-0.39.patch
-  # https://github.com/spulec/moto/pull/3308
-  patch -Np1 -i ../$pkgname-boto3-1.14.59.patch
-  # https://github.com/spulec/moto/pull/3466
-  patch -Np1 -i ../$pkgname-responses-0.12.1.patch
-  # https://github.com/spulec/moto/pull/3575
-  patch -Np1 -i ../$pkgname-botocore-1.19.41.patch
-
   # Remove upper bounds of dependencies
   sed --in-place=.orig -r 's#,?<[0-9.]+,?##;s#==([0-9.]+)#>=\1#' setup.py
   diff -u setup.py{.orig,} || true
@@ -62,30 +59,16 @@
 check() {
   cd $_pkgname-$pkgver
 
-  # * test_lambda tests moto.awslambda, which requires a running docker.service
-  # * test_submit_job_by_name calls batch_client.submit_job, and the latter
-  #   creates a Job object, which requires docker
-  # * In test_create_stack_lambda_and_dynamodb, the CloudFormation template
-  #   contain AWS::Lambda resources and thus uses moto.awslambda
-  # * test_create_notebook_instance_bad_volume_size,
-  # * test_describe_parameters_parameter_validation: fixed in
-  #   https://github.com/spulec/moto/pull/3628. Disable tests here as the
-  #   patch cannot be applied cleanly. Note that in #3628, the removed test
-  #   test_describe_parameters_parameter_validation is one of tests split
-  #   from test_describe_parameters_invalid_parameter_filters in
-  #   https://github.com/spulec/moto/pull/3610
-  TZ=UTC nosetests -s ./tests/ \
-    --exclude='test_lambda' \
-    --exclude='test_list_jobs' \
-    --exclude='test_submit_job' \
-    --exclude='test_submit_job_by_name' \
-    --exclude='test_terminate_job' \
-    --exclude='test_create_stack_lambda_and_dynamodb' \
-    --exclude='test_delete_subscription_filter_errors' \
-    --exclude='test_put_subscription_filter_update' \
-    --exclude='test_put_subscription_filter_with_lambda' \
-    --exclude='test_create_notebook_instance_bad_volume_size' \
-    --exclude='test_describe_parameters_invalid_parameter_filters'
+  # XXX: there are too many tests that depend on docker/podman, and there is no simple way
+  # other than listing one-by-one for exclusion. To make things worse, running docker/podman
+  # in systemd-nspawn containers appears impossible without special configurations. I gave
+  # it up and running podman _outside_ the container for testing.
+  # $ podman system service "unix:$XDG_RUNTIME_DIR/podman/podman.sock" -t 0
+  # $ extra-x86_64-build -- -d "$XDG_RUNTIME_DIR/podman:/tmp/podman"
+  PODMAN_SOCK=/tmp/podman/podman.sock
+  if [ -S $PODMAN_SOCK ]; then
+    DOCKER_HOST="unix://$PODMAN_SOCK" TZ=UTC pytest tests
+  fi
 }
 
 package() {

Deleted: python-moto-botocore-1.19.41.patch
===================================================================
--- python-moto-botocore-1.19.41.patch	2021-02-27 16:47:04 UTC (rev 875350)
+++ python-moto-botocore-1.19.41.patch	2021-02-27 18:40:18 UTC (rev 875351)
@@ -1,149 +0,0 @@
-From 9ecea2012a19cf929f03271dddf5ce3e17943f48 Mon Sep 17 00:00:00 2001
-From: Bert Blommers <bblommers at users.noreply.github.com>
-Date: Thu, 7 Jan 2021 03:18:50 -0800
-Subject: [PATCH] Fix Blockchain to work with new API (#3575)
-
-* Fix Blockchain to work with new API
-
-* Improve Lambda->SQS error handling
----
- moto/managedblockchain/responses.py |  8 ++++----
- moto/managedblockchain/urls.py      |  3 +++
- moto/managedblockchain/utils.py     | 14 ++++++++++++--
- moto/sqs/models.py                  |  6 ++----
- requirements-dev.txt                |  2 +-
- setup.py                            |  2 +-
- 6 files changed, 23 insertions(+), 12 deletions(-)
-
-diff --git a/moto/managedblockchain/responses.py b/moto/managedblockchain/responses.py
-index 7dd628eba..55252925d 100644
---- a/moto/managedblockchain/responses.py
-+++ b/moto/managedblockchain/responses.py
-@@ -10,7 +10,7 @@
-     networkid_from_managedblockchain_url,
-     proposalid_from_managedblockchain_url,
-     invitationid_from_managedblockchain_url,
--    memberid_from_managedblockchain_url,
-+    memberid_from_managedblockchain_request,
-     nodeid_from_managedblockchain_url,
- )
- 
-@@ -297,7 +297,7 @@ def _memberid_response(self, request, full_url, headers):
-         else:
-             body = request.data
-         network_id = networkid_from_managedblockchain_url(full_url)
--        member_id = memberid_from_managedblockchain_url(full_url)
-+        member_id = memberid_from_managedblockchain_request(full_url, body)
-         if method == "GET":
-             return self._memberid_response_get(network_id, member_id, headers)
-         elif method == "PATCH":
-@@ -343,7 +343,7 @@ def _node_response(self, request, full_url, headers):
-         parsed_url = urlparse(full_url)
-         querystring = parse_qs(parsed_url.query, keep_blank_values=True)
-         network_id = networkid_from_managedblockchain_url(full_url)
--        member_id = memberid_from_managedblockchain_url(full_url)
-+        member_id = memberid_from_managedblockchain_request(full_url, body)
-         if method == "GET":
-             status = None
-             if "status" in querystring:
-@@ -394,7 +394,7 @@ def _nodeid_response(self, request, full_url, headers):
-         else:
-             body = request.data
-         network_id = networkid_from_managedblockchain_url(full_url)
--        member_id = memberid_from_managedblockchain_url(full_url)
-+        member_id = memberid_from_managedblockchain_request(full_url, body)
-         node_id = nodeid_from_managedblockchain_url(full_url)
-         if method == "GET":
-             return self._nodeid_response_get(network_id, member_id, node_id, headers)
-diff --git a/moto/managedblockchain/urls.py b/moto/managedblockchain/urls.py
-index 442a73233..9bc2491f5 100644
---- a/moto/managedblockchain/urls.py
-+++ b/moto/managedblockchain/urls.py
-@@ -16,4 +16,7 @@
-     "{0}/networks/(?P<networkid>[^/.]+)/members/(?P<memberid>[^/.]+)/nodes$": ManagedBlockchainResponse.node_response,
-     "{0}/networks/(?P<networkid>[^/.]+)/members/(?P<memberid>[^/.]+)/nodes?(?P<querys>[^/.]+)$": ManagedBlockchainResponse.node_response,
-     "{0}/networks/(?P<networkid>[^/.]+)/members/(?P<memberid>[^/.]+)/nodes/(?P<nodeid>[^/.]+)$": ManagedBlockchainResponse.nodeid_response,
-+    # >= botocore 1.19.41 (API change - memberId is now part of query-string or body)
-+    "{0}/networks/(?P<networkid>[^/.]+)/nodes$": ManagedBlockchainResponse.node_response,
-+    "{0}/networks/(?P<networkid>[^/.]+)/nodes/(?P<nodeid>[^/.]+)$": ManagedBlockchainResponse.nodeid_response,
- }
-diff --git a/moto/managedblockchain/utils.py b/moto/managedblockchain/utils.py
-index d0485829b..84d5137a8 100644
---- a/moto/managedblockchain/utils.py
-+++ b/moto/managedblockchain/utils.py
-@@ -1,8 +1,9 @@
-+import json
- import random
- import re
- import string
- 
--from six.moves.urllib.parse import urlparse
-+from six.moves.urllib.parse import parse_qs, urlparse
- 
- 
- def region_from_managedblckchain_url(url):
-@@ -27,11 +28,20 @@ def get_network_id():
-     )
- 
- 
--def memberid_from_managedblockchain_url(full_url):
-+def memberid_from_managedblockchain_request(full_url, body):
-     id_search = re.search("\/m-[A-Z0-9]{26}", full_url, re.IGNORECASE)
-     return_id = None
-     if id_search:
-         return_id = id_search.group(0).replace("/", "")
-+    else:
-+        # >= botocore 1.19.41 can add the memberId as a query parameter, or in the body
-+        parsed_url = urlparse(full_url)
-+        qs = parse_qs(parsed_url.query)
-+        if "memberId" in qs:
-+            return_id = qs.get("memberId")[0]
-+        elif body:
-+            body = json.loads(body)
-+            return_id = body["MemberId"]
-     return return_id
- 
- 
-diff --git a/moto/sqs/models.py b/moto/sqs/models.py
-index 421a1e5c7..a493c9428 100644
---- a/moto/sqs/models.py
-+++ b/moto/sqs/models.py
-@@ -518,10 +518,8 @@ def add_message(self, message):
-             if result:
-                 [backend.delete_message(self.name, m.receipt_handle) for m in messages]
-             else:
--                [
--                    backend.change_message_visibility(self.name, m.receipt_handle, 0)
--                    for m in messages
--                ]
-+                # Make messages visible again
-+                [m.change_visibility(visibility_timeout=0) for m in messages]
- 
-     def get_cfn_attribute(self, attribute_name):
-         from moto.cloudformation.exceptions import UnformattedGetAttTemplateException
-diff --git a/requirements-dev.txt b/requirements-dev.txt
-index 692a1cbf3..2df056d85 100644
---- a/requirements-dev.txt
-+++ b/requirements-dev.txt
-@@ -21,7 +21,7 @@ beautifulsoup4==4.6.0
- # The below pins mirror the Python version-conditional pins in setup.py
- #
- Jinja2>=2.10.1; python_version >= '3.6'
--mock; python_version >= '3.6'
-+mock<=4.0.2; python_version >= '3.6'
- more-itertools; python_version >= '3.6'
- setuptools; python_version >= '3.6'
- sshpubkeys>=3.1.0; python_version >= '3.6'
-diff --git a/setup.py b/setup.py
-index 913565eb4..0aab0bcff 100755
---- a/setup.py
-+++ b/setup.py
-@@ -70,7 +70,7 @@ def get_version():
- else:
-     install_requires += [
-         "Jinja2>=2.10.1",
--        "mock",
-+        "mock<=4.0.2",
-         "more-itertools",
-         "setuptools",
-         "zipp",



More information about the arch-commits mailing list