From 58c02d28c216d4195429b220d14ba7326e93a62b Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 27 Jul 2016 15:10:53 +0200 Subject: insert(replace=False) should really be a no-op if path is found that includes removing duplicates. --- pkg_resources/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg_resources') diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 6aabd4c5..6d472734 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2620,7 +2620,11 @@ class Distribution(object): for p, item in enumerate(npath): if item == nloc: - break + if replace: + break + else: + # don't modify path (even removing duplicates) if found and not replace + return elif item == bdir and self.precedence == EGG_DIST: # if it's an .egg, give it precedence over its directory # UNLESS it's already been added to sys.path and replace=False -- cgit v1.2.3