From ffb2e6994a3405c2ab007ab9564bb02c9263eb6c Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 15 Oct 2017 12:48:33 -0500 Subject: 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. --- setuptools/build_meta.py | 3 +++ 1 file changed, 3 insertions(+) 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') -- cgit v1.2.1