Skip to content

Commit

Permalink
resolve(): Revert some pkg_resources magic
Browse files Browse the repository at this point in the history
  • Loading branch information
userzimmermann committed Aug 9, 2019
1 parent 090448d commit a46fea9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions zetup/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a46fea9

Please sign in to comment.