Commit ffb2e699 authored by xoviat's avatar xoviat Committed by GitHub

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.
parent 2958de38
......@@ -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')
......
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