Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
e9e4cf8c
Commit
e9e4cf8c
authored
Sep 09, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Short circuit and dedent large block
parent
5df09426
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
pkg_resources/__init__.py
pkg_resources/__init__.py
+33
-32
No files found.
pkg_resources/__init__.py
View file @
e9e4cf8c
...
...
@@ -2028,39 +2028,40 @@ def find_on_path(importer, path_item, only=False):
path_item, os.path.join(path_item, 'EGG-INFO')
)
)
else:
try:
entries = os.listdir(path_item)
except (PermissionError, NotADirectoryError):
return
try:
entries = os.listdir(path_item)
except (PermissionError, NotADirectoryError):
return
except OSError as e:
# Ignore the directory if does not exist, not a directory or we
# don't have permissions
ignorable = (
e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT)
# Python 2 on Windows needs to be handled this way :(
or getattr(e, "winerror", None) == 267
)
if ignorable:
return
except OSError as e:
# Ignore the directory if does not exist, not a directory or we
# don't have permissions
ignorable = (
e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT)
# Python 2 on Windows needs to be handled this way :(
or getattr(e, "winerror", None) == 267
)
if ignorable:
return
raise
# scan for .egg and .egg-info in directory
path_item_entries = _by_version_descending(entries)
for entry in path_item_entries:
lower = entry.lower()
fullpath = os.path.join(path_item, entry)
is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info')))
dists = (
distributions_from_metadata(fullpath)
if is_meta else
find_distributions(fullpath)
if not only and _is_egg_path(entry) else
resolve_egg_link(fullpath)
if not only and lower.endswith('.egg-link') else
()
)
for dist in dists:
yield dist
raise
# scan for .egg and .egg-info in directory
path_item_entries = _by_version_descending(entries)
for entry in path_item_entries:
lower = entry.lower()
fullpath = os.path.join(path_item, entry)
is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info')))
dists = (
distributions_from_metadata(fullpath)
if is_meta else
find_distributions(fullpath)
if not only and _is_egg_path(entry) else
resolve_egg_link(fullpath)
if not only and lower.endswith('.egg-link') else
()
)
for dist in dists:
yield dist
def distributions_from_metadata(path):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment