aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/monkey.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/monkey.py')
-rw-r--r--setuptools/monkey.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/setuptools/monkey.py b/setuptools/monkey.py
new file mode 100644
index 00000000..b6baf49d
--- /dev/null
+++ b/setuptools/monkey.py
@@ -0,0 +1,22 @@
+"""
+Monkey patching of distutils.
+"""
+
+
+__all__ = []
+"everything is private"
+
+
+def _get_unpatched(cls):
+ """Protect against re-patching the distutils if reloaded
+
+ Also ensures that no other distutils extension monkeypatched the distutils
+ first.
+ """
+ while cls.__module__.startswith('setuptools'):
+ cls, = cls.__bases__
+ if not cls.__module__.startswith('distutils'):
+ raise AssertionError(
+ "distutils has already been patched by %r" % cls
+ )
+ return cls