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
b6a3ccf9
Commit
b6a3ccf9
authored
Nov 22, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract function for detecting unpacked egg. Ref #462.
parent
a88effc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
pkg_resources/__init__.py
pkg_resources/__init__.py
+12
-5
No files found.
pkg_resources/__init__.py
View file @
b6a3ccf9
...
...
@@ -1716,7 +1716,7 @@ class EggProvider(NullProvider):
path
=
self
.
module_path
old
=
None
while
path
!=
old
:
if
path
.
lower
().
endswith
(
'.egg'
):
if
_is_unpacked_egg
(
path
):
self
.
egg_name
=
os
.
path
.
basename
(
path
)
self
.
egg_info
=
os
.
path
.
join
(
path
,
'EGG-INFO'
)
self
.
egg_root
=
path
...
...
@@ -2099,7 +2099,7 @@ def find_eggs_in_zip(importer, path_item, only=False):
# don't yield nested distros
return
for
subitem
in
metadata
.
resource_listdir
(
'/'
):
if
subitem
.
endswith
(
'.egg'
):
if
_is_unpacked_egg
(
subitem
):
subpath
=
os
.
path
.
join
(
path_item
,
subitem
)
for
dist
in
find_eggs_in_zip
(
zipimport
.
zipimporter
(
subpath
),
subpath
):
yield
dist
...
...
@@ -2115,8 +2115,7 @@ def find_on_path(importer, path_item, only=False):
path_item
=
_normalize_cached
(
path_item
)
if
os
.
path
.
isdir
(
path_item
)
and
os
.
access
(
path_item
,
os
.
R_OK
):
if
path_item
.
lower
().
endswith
(
'.egg'
):
# unpacked egg
if
_is_unpacked_egg
(
path_item
):
yield
Distribution
.
from_filename
(
path_item
,
metadata
=
PathMetadata
(
path_item
,
os
.
path
.
join
(
path_item
,
'EGG-INFO'
)
...
...
@@ -2136,7 +2135,7 @@ def find_on_path(importer, path_item, only=False):
yield
Distribution
.
from_location
(
path_item
,
entry
,
metadata
,
precedence
=
DEVELOP_DIST
)
elif
not
only
and
lower
.
endswith
(
'.egg'
):
elif
not
only
and
_is_unpacked_egg
(
entry
):
dists
=
find_distributions
(
os
.
path
.
join
(
path_item
,
entry
))
for
dist
in
dists
:
yield
dist
...
...
@@ -2283,6 +2282,14 @@ def _normalize_cached(filename, _cache={}):
_cache
[
filename
]
=
result
=
normalize_path
(
filename
)
return
result
def
_is_unpacked_egg
(
path
):
"""
Determine if given path appears to be an unpacked egg.
"""
return
(
path
.
lower
().
endswith
(
'.egg'
)
)
def
_set_parent_ns
(
packageName
):
parts
=
packageName
.
split
(
'.'
)
name
=
parts
.
pop
()
...
...
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