Commit 5273dbae authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #629 from kata198/master

Fix issues with distribution location from eggs
parents 48317edf e0805ec6
......@@ -1983,12 +1983,20 @@ 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.sort()
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)
if os.path.isdir(fullpath):
# egg-info directory, allow getting metadata
if len(os.listdir(fullpath)) == 0:
# Empty egg directory, skip.
continue
metadata = PathMetadata(path_item, fullpath)
else:
metadata = FileMetadata(fullpath)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment