aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources
diff options
context:
space:
mode:
authorTim Savannah <kata198@gmail.com>2016-07-05 16:37:26 -0400
committerTim Savannah <kata198@gmail.com>2016-07-05 16:37:26 -0400
commitfb1867e305660161c2960dfcfc5a95d41310e19d (patch)
tree1645a2c9aeed9aecd4a600872edb9f3722704ff5 /pkg_resources
parent1b228fa0e3f07c73de0053985565293b795e6e96 (diff)
downloadexternal_python_setuptools-fb1867e305660161c2960dfcfc5a95d41310e19d.tar.gz
external_python_setuptools-fb1867e305660161c2960dfcfc5a95d41310e19d.tar.bz2
external_python_setuptools-fb1867e305660161c2960dfcfc5a95d41310e19d.zip
Scan for distributions in reverse order, so we find the newest version of a distribution (instead of the oldest)
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)