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
d3fc6036
Commit
d3fc6036
authored
Sep 09, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen entries before sorting in find_on_path. Ref #1134.
parent
6f10cff4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
CHANGES.rst
CHANGES.rst
+7
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+13
-1
No files found.
CHANGES.rst
View file @
d3fc6036
v36
.5.0
-------
*
Inspired
by
#
1134
,
performed
substantial
refactoring
of
``
pkg_resources
.
find_on_path
``
to
facilitate
an
optimization
for
paths
with
many
non
-
version
entries
.
v36
.4.0
-------
...
...
pkg_resources/__init__.py
View file @
d3fc6036
...
...
@@ -2032,8 +2032,17 @@ def find_on_path(importer, path_item, only=False):
entries = safe_listdir(path_item)
# for performance, before sorting by version,
# screen entries for only those that will yield
# distributions
filtered = (
entry
for entry in entries
if dist_factory(path_item, entry, only)
)
# scan for .egg and .egg-info in directory
path_item_entries = _by_version_descending(
entries
)
path_item_entries = _by_version_descending(
filtered
)
for entry in path_item_entries:
fullpath = os.path.join(path_item, entry)
factory = dist_factory(path_item, entry, only)
...
...
@@ -2042,6 +2051,9 @@ def find_on_path(importer, path_item, only=False):
def dist_factory(path_item, entry, only):
"""
Return
a
dist_factory
for
a
path_item
and
entry
"""
lower = entry.lower()
is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info')))
return (
...
...
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