Skip to content

Commit

Permalink
Remove the setuptools-provided distutils hack, if using distutils
Browse files Browse the repository at this point in the history
This ensures that pip's imported copy of distutils comes from the
standard library, if/when the hack needs to be used.
  • Loading branch information
pradyunsg committed Jul 24, 2022
1 parent 9351efd commit 04f2091
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pip/_internal/locations/_distutils.py
Expand Up @@ -3,6 +3,14 @@
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False

# If pip's going to use distutils, it should not be using the copy that setuptools
# might have injected into the environment. The least-worst option for ensuring this
# seems to be to try to remove the injected shim, if it's injected.
try:
__import__("_distutils_hack").remove_shim()
except ImportError:
pass

import logging
import os
import sys
Expand Down

0 comments on commit 04f2091

Please sign in to comment.