From 43947fdec9768f0373406d99a9ef44675510df65 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 24 Oct 2021 22:38:14 +0200 Subject: [PATCH] Update minimum version of requests dependency we require as part of install_requires in setup.py to 2.26.0 when running under Python >= 3.6. This was done to avoid potential licensing issue with transitive dependency of the requests library (chardet). NOTE: Since requests 2.26.0 dropped support for Python 3.5 which we still stupport, requests >= 2.25.1 is required when running under Python 3.5. Thanks to Jarek Potiuk - @potiuk for reporting this issue. Resolves #1594. --- requirements-tests.txt | 3 ++- setup.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index 5eb23e24b9..6af9501d5a 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -5,7 +5,8 @@ pylint==2.4.4 mock==3.0.5 codecov==2.1.12 coverage==4.5.4 -requests +requests>=2.25.0; python_version <= '3.5' +requests>=2.26.0; python_version >= '3.6' requests_mock # 5.3.2 is latest version which still supports Python 3.5, >= 6.2.5 is needed for Python 3.10 pytest==5.3.2; python_version <= '3.5' diff --git a/setup.py b/setup.py index 65a51c56af..a1d0b7d99d 100644 --- a/setup.py +++ b/setup.py @@ -173,9 +173,16 @@ def get_data_files(dname, ignore=None, parent=None): # setuptools >= 36.2 # For installation, minimum required pip version is 1.4 # Reference: https://hynek.me/articles/conditional-python-dependencies/ -INSTALL_REQUIREMENTS = [ - 'requests>=2.5.0', -] +# We rely on >= 2.26.0 to avoid issues with LGL transitive dependecy +# See https://github.com/apache/libcloud/issues/1594 for more context +INSTALL_REQUIREMENTS = [] + +if sys.version_info < (3, 6, 0): + # requests 2.26.0 doesn't support Python 3.5 anymore + INSTALL_REQUIREMENTS.append('requests>=2.25.1') +else: + INSTALL_REQUIREMENTS.append('requests>=2.26.0') + setuptools_version = tuple(setuptools.__version__.split(".")[0:2]) setuptools_version = tuple([int(c) for c in setuptools_version])