From 758a99f2ea5d1a3049e45c56a9e5b022d5cbcb77 Mon Sep 17 00:00:00 2001 From: Brad Solomon Date: Thu, 28 May 2020 16:07:36 -0400 Subject: [PATCH] Ignore python_requires when installing with distutils When using python setup.py , distutils.dist.Distribution does not recognize python_requires (unlike setuptools) and will issue an obnoxious warning that doesn't actually tell the user that their Python version is not supported. Note that this (might not be) the case with pip since it replaces distutils with setuptools, which does support it. The other possible solution would be to parse python_requires, but that requires a lot of work (see pip/_internals/utils/packaging.py) and is an example of the reason setuptools was made in the first place. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5e34adfb..1258149f 100644 --- a/setup.py +++ b/setup.py @@ -95,7 +95,6 @@ # on Windows, disable wheel generation warning noise windows_ignore_warnings = [ -"Unknown distribution option: 'python_requires'", "Config variable 'Py_DEBUG' is unset", "Config variable 'WITH_PYMALLOC' is unset", "Config variable 'Py_UNICODE_SIZE' is unset", @@ -109,6 +108,7 @@ class Distribution(_Distribution): def __init__(self, attrs=None): + attrs.pop('python_requires', None) _Distribution.__init__(self, attrs) if not self.ext_modules: return