diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-31 08:50:31 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-31 08:51:20 -0400 |
| commit | 9962c0af814ccd13c370ce8b04742a52f77025c6 (patch) | |
| tree | 51b3a1a5d829da474394c37e32cbb955716f77df /setuptools | |
| parent | 4ac101a1805a3773649b42c7682038f41314738e (diff) | |
| download | external_python_setuptools-9962c0af814ccd13c370ce8b04742a52f77025c6.tar.gz external_python_setuptools-9962c0af814ccd13c370ce8b04742a52f77025c6.tar.bz2 external_python_setuptools-9962c0af814ccd13c370ce8b04742a52f77025c6.zip | |
Extract function for ensure_local_distuils
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/distutils_patch.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index e0abbd77..43b64c0f 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -21,9 +21,11 @@ def patch_sys_path(): sys.path[:] = orig -if 'distutils' in sys.path: - raise RuntimeError("Distutils must not be imported before setuptools") +def ensure_local_distutils(): + if 'distutils' in sys.path: + raise RuntimeError("Distutils must not be imported before setuptools") + with patch_sys_path(): + importlib.import_module('distutils') -with patch_sys_path(): - importlib.import_module('distutils') +ensure_local_distutils() |
