summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <xoviat@users.noreply.github.com>2017-10-15 12:48:33 -0500
committerGitHub <noreply@github.com>2017-10-15 12:48:33 -0500
commitffb2e6994a3405c2ab007ab9564bb02c9263eb6c (patch)
treeb5015d32d6be60cc06f23f506bc10bae6d3c6335
parent2958de38af3529bba1fe4a27bd20e02c8ca16e1f (diff)
downloadpython-setuptools-git-ffb2e6994a3405c2ab007ab9564bb02c9263eb6c.tar.gz
BUG: re-initialize the master working set
In some cases (specifically when pip imports this module in a virtualenv), pkg_resources can already be imported, causing setuptools to load entry_points from an older version. Here, we re-initialize the master working set to fix the case where the entry points from an older setuptools are loaded.
-rw-r--r--setuptools/build_meta.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py
index 54f2987b..365e24ee 100644
--- a/setuptools/build_meta.py
+++ b/setuptools/build_meta.py
@@ -35,6 +35,8 @@ import contextlib
import setuptools
import distutils
+from pkg_resources import _initialize_master_working_set
+
class SetupRequirementsError(BaseException):
def __init__(self, specifiers):
@@ -64,6 +66,7 @@ class Distribution(setuptools.dist.Distribution):
def _run_setup(setup_script='setup.py'):
# Note that we can reuse our build directory between calls
# Correctness comes first, then optimization later
+ _initialize_master_working_set()
__file__ = setup_script
f = getattr(tokenize, 'open', open)(__file__)
code = f.read().replace('\\r\\n', '\\n')