diff --git a/product/gradle-plugin/src/main/python/chaquopy_monkey.py b/product/gradle-plugin/src/main/python/chaquopy_monkey.py index 2967347ee3..035f07bea0 100644 --- a/product/gradle-plugin/src/main/python/chaquopy_monkey.py +++ b/product/gradle-plugin/src/main/python/chaquopy_monkey.py @@ -41,7 +41,9 @@ def disable_native(): def disable_native_distutils(): # Recent versions of setuptools redirect distutils to their own bundled copy, so try - # to import that first. + # to import that first. Even more recent versions of setuptools provide a .pth file + # which makes this import unnecessary, but the package we're installing might have + # pinned an older version in its pyproject.toml file. try: import setuptools # noqa: F401 except ImportError: diff --git a/product/gradle-plugin/src/main/python/pip/__main__.py b/product/gradle-plugin/src/main/python/pip/__main__.py index 7c2505fa5b..ec33692e09 100644 --- a/product/gradle-plugin/src/main/python/pip/__main__.py +++ b/product/gradle-plugin/src/main/python/pip/__main__.py @@ -3,6 +3,12 @@ import os import sys +# Chaquopy: get_command_obj in locations.py triggers this warning with recent versions +# of setuptools, even when no setup.py script is being run. Disable it globally within +# the pip process. +import warnings +warnings.filterwarnings('ignore', 'setup.py install is deprecated') + # Remove '' and current working directory from the first entry # of sys.path, if present to avoid using current directory # in pip commands check, freeze, install, list and show,