aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources
diff options
context:
space:
mode:
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 35725c06..645eda81 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1969,7 +1969,11 @@ def find_on_path(importer, path_item, only=False):
)
else:
# scan for .egg and .egg-info in directory
- for entry in os.listdir(path_item):
+
+ path_item_entries = os.listdir(path_item)
+ # Reverse so we find the newest version of a distribution,
+ path_item_entries.reverse()
+ for entry in path_item_entries:
lower = entry.lower()
if lower.endswith('.egg-info') or lower.endswith('.dist-info'):
fullpath = os.path.join(path_item, entry)