{
    "mode": "pydoc",
    "parameter": "_distutils_hack",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/_distutils_hack/json",
    "generated": "2026-12-03T14:14:24Z",
    "sections": {
        "NAME": {
            "content": "distutilshack - # don't import any costly modules\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "override\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.object\nDistutilsMetaFinder\nshim\n",
            "subsections": [
                {
                    "name": "class DistutilsMetaFinder",
                    "content": "|  Methods defined here:\n|\n|  findspec(self, fullname, path, target=None)\n|\n|  specfordistutils(self)\n|\n|  specforpip(self)\n|      Ensure stdlib distutils when running under pip.\n|      See pypa/pip#8761 for rationale.\n|\n|  specforsensitivetests(self)\n|      Ensure stdlib distutils when running select tests under CPython.\n|\n|      python/cpython#91169\n|\n|  specfortest.testdistutils = specforsensitivetests(self)\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  pipimportedduringbuild()\n|      Detect if pip is being imported in a build script. Ref #2355.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  framefileissetup(frame)\n|      Return True if the indicated frame suggests a setup.py file.\n|\n|  iscpython()\n|      Suppress supplying distutils for CPython (build and tests).\n|      Ref #2965 and #3007.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  sensitivetests = ['test.testdistutils']\n"
                },
                {
                    "name": "class shim",
                    "content": "|  Methods defined here:\n|\n|  enter(self)\n|\n|  exit(self, exc, value, tb)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "add_shim",
                    "content": ""
                },
                {
                    "name": "clear_distutils",
                    "content": ""
                },
                {
                    "name": "do_override",
                    "content": "Ensure that the local copy of distutils is preferred over stdlib.\n\nSee https://github.com/pypa/setuptools/issues/417#issuecomment-392298401\nfor more motivation.\n"
                },
                {
                    "name": "enabled",
                    "content": "Allow selection of distutils by environment variable.\n"
                },
                {
                    "name": "ensure_local_distutils",
                    "content": ""
                },
                {
                    "name": "insert_shim",
                    "content": ""
                },
                {
                    "name": "warn_distutils_present",
                    "content": ""
                }
            ]
        },
        "DATA": {
            "content": "DISTUTILSFINDER = <distutilshack.DistutilsMetaFinder object>\nispypy = False\nname = 'test.testdistutils'\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/distutilshack/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "distutilshack - # don't import any costly modules",
    "flags": [],
    "examples": [],
    "see_also": []
}