From a46fea946ec8d91b89f46b8fb6d71e6beba8115a Mon Sep 17 00:00:00 2001 From: Stefan Zimmermann Date: Fri, 9 Aug 2019 21:29:40 +0200 Subject: [PATCH] resolve(): Revert some pkg_resources magic --- zetup/resolve.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/zetup/resolve.py b/zetup/resolve.py index 9113bef..1db96ac 100644 --- a/zetup/resolve.py +++ b/zetup/resolve.py @@ -93,20 +93,26 @@ def _resolve(requirements, parent=None): except (DistributionNotFound, VersionConflict) as exc: if isinstance(exc, VersionConflict): pip.uninstall(re.split(r'\W', req)[0], '--yes') - pkg_resources._initialize_master_working_set() + # pkg_resources._initialize_master_working_set() + + # adapt pkg_resources to the newly installed requirement + pkg_resources.working_set = working_set = WorkingSet() + pkg_resources.require = working_set.require + pkg_resources.iter_entry_points = ( + working_set.iter_entry_points) pip.install(req) - pkg_resources._initialize_master_working_set() + # pkg_resources._initialize_master_working_set() + + # adapt pkg_resources to the newly installed requirement + pkg_resources.working_set = working_set = WorkingSet() + pkg_resources.require = working_set.require + pkg_resources.iter_entry_points = ( + working_set.iter_entry_points) dist = get_distribution(req) sys.path.insert(0, dist.location) - # adapt pkg_resources to the newly installed requirement - # pkg_resources.working_set = working_set = WorkingSet() - # pkg_resources.require = working_set.require - # pkg_resources.iter_entry_points = ( - # working_set.iter_entry_points) - print(repr(dist)) extras = re.match(r'[^#\[]*\[([^#\]]*)\]', req)