Skip to content

Commit

Permalink
Fix "setup.py install is deprecated" warnings within pip process
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Nov 25, 2023
1 parent 5e80833 commit d1a99f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion product/gradle-plugin/src/main/python/chaquopy_monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions product/gradle-plugin/src/main/python/pip/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d1a99f6

Please sign in to comment.