diff --git a/moto/s3/models.py b/moto/s3/models.py index 7373dc9e3..866c5d007 100644 --- a/moto/s3/models.py +++ b/moto/s3/models.py @@ -1370,7 +1370,7 @@ class S3Backend(BaseBackend): raise MissingKey(key_name) self.tagger.delete_all_tags_for_resource(key.arn) self.tagger.tag_resource( - key.arn, [{"Key": key, "Value": value} for key, value in tags.items()], + key.arn, [{"Key": k, "Value": v} for (k, v) in tags.items()], ) return key diff --git a/requirements-dev.txt b/requirements-dev.txt index 2b43bcf9d..313f2dfb6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,4 @@ -r requirements.txt -mock<=3.0.5 # Last version compatible with Python 2.7 nose black; python_version >= '3.6' regex==2019.11.1; python_version >= '3.6' # Needed for black @@ -18,3 +17,21 @@ click==6.7 inflection==0.3.1 lxml==4.2.3 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' +more-itertools; python_version >= '3.6' +setuptools; python_version >= '3.6' +sshpubkeys>=3.1.0; python_version >= '3.6' +zipp; python_version >= '3.6' + +configparser<5.0; python_version == '2.7' +Jinja2<3.0.0,>=2.10.1; python_version == '2.7' +mock<=3.0.5; python_version == '2.7' +more-itertools==5.0.0; python_version == '2.7' +setuptools==44.0.0; python_version == '2.7' +sshpubkeys>=3.1.0,<4.0; python_version == '2.7' +zipp==0.6.0; python_version == '2.7' diff --git a/setup.py b/setup.py index 684c0dcea..994e55300 100755 --- a/setup.py +++ b/setup.py @@ -8,6 +8,8 @@ import setuptools from setuptools import setup, find_packages import sys +PY2 = sys.version_info[0] == 2 + # Borrowed from pip at https://github.com/pypa/pip/blob/62c27dee45625e1b63d1e023b0656310f276e050/setup.py#L11-L15 here = os.path.abspath(os.path.dirname(__file__)) @@ -28,8 +30,6 @@ def get_version(): install_requires = [ - "setuptools==44.0.0", - "Jinja2<3.0.0,>=2.10.1", "boto>=2.36.0", "boto3>=1.9.201", "botocore>=1.12.201", @@ -42,18 +42,48 @@ install_requires = [ "pytz", "python-dateutil<3.0.0,>=2.1", "python-jose<4.0.0", - "mock<=3.0.5", "docker>=2.5.1", "jsondiff>=1.1.2", "aws-xray-sdk!=0.96,>=0.93", "responses>=0.9.0", "idna<3,>=2.5", "cfn-lint>=0.4.0", - "sshpubkeys>=3.1.0,<4.0", - "zipp==0.6.0", - "more-itertools==5.0.0" + "MarkupSafe<2.0", # This is a Jinja2 dependency, 2.0.0a1 currently seems broken ] +# +# Avoid pins where they are not necessary. These pins were introduced by the +# following commit for Py2 compatibility. They are not required for non-Py2 +# users. +# +# https://github.com/mpenkov/moto/commit/00134d2df37bb4dcd5f447ef951d383bfec0903c +# +if PY2: + install_requires += [ + # + # This is an indirect dependency. Version 5.0.0 claims to be for + # Py2.6+, but it really isn't. + # + # https://github.com/jaraco/configparser/issues/51 + # + "configparser<5.0", + "Jinja2<3.0.0,>=2.10.1", + "mock<=3.0.5", + "more-itertools==5.0.0", + "setuptools==44.0.0", + "sshpubkeys>=3.1.0,<4.0", + "zipp==0.6.0", + ] +else: + install_requires += [ + "Jinja2>=2.10.1", + "mock", + "more-itertools", + "setuptools", + "sshpubkeys>=3.1.0", + "zipp", + ] + extras_require = { 'server': ['flask'], }