Commit bb9fb1fc authored by Jason R. Coombs's avatar Jason R. Coombs

Move distutils into a submodule of setuptools.

parent c486771a
...@@ -14,7 +14,7 @@ def pytest_addoption(parser): ...@@ -14,7 +14,7 @@ def pytest_addoption(parser):
collect_ignore = [ collect_ignore = [
'tests/manual_test.py', 'tests/manual_test.py',
'setuptools/tests/mod_with_constant.py', 'setuptools/tests/mod_with_constant.py',
'distutils', 'setuptools/_distutils',
] ]
......
...@@ -8,19 +8,7 @@ for more motivation. ...@@ -8,19 +8,7 @@ for more motivation.
import sys import sys
import re import re
import importlib import importlib
import contextlib
import warnings import warnings
from os.path import dirname
@contextlib.contextmanager
def patch_sys_path():
orig = sys.path[:]
sys.path[:] = [dirname(dirname(__file__))]
try:
yield
finally:
sys.path[:] = orig
def clear_distutils(): def clear_distutils():
...@@ -34,9 +22,12 @@ def clear_distutils(): ...@@ -34,9 +22,12 @@ def clear_distutils():
def ensure_local_distutils(): def ensure_local_distutils():
clear_distutils() clear_distutils()
with patch_sys_path(): distutils = importlib.import_module('setuptools._distutils')
importlib.import_module('distutils') sys.modules['distutils'] = distutils
assert sys.modules['distutils'].local
# sanity check that submodules load as expected
core = importlib.import_module('distutils.core')
assert '_distutils' in core.__file__, core.__file__
ensure_local_distutils() ensure_local_distutils()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment