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
11051abd
Commit
11051abd
authored
May 28, 2020
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract _parents function and _set_egg method. Reword comment.
parent
41732cd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
pkg_resources/__init__.py
pkg_resources/__init__.py
+21
-12
No files found.
pkg_resources/__init__.py
View file @
11051abd
...
@@ -1577,6 +1577,17 @@ is not allowed.
...
@@ -1577,6 +1577,17 @@ is not allowed.
register_loader_type(object, NullProvider)
register_loader_type(object, NullProvider)
def _parents(path):
"""
yield all parents of path including path
"""
last = None
while path != last:
yield path
last = path
path, _ = os.path.split(path)
class EggProvider(NullProvider):
class EggProvider(NullProvider):
"""Provider based on a virtual filesystem"""
"""Provider based on a virtual filesystem"""
...
@@ -1585,18 +1596,16 @@ class EggProvider(NullProvider):
...
@@ -1585,18 +1596,16 @@ class EggProvider(NullProvider):
self._setup_prefix()
self._setup_prefix()
def _setup_prefix(self):
def _setup_prefix(self):
# we assume here that our metadata may be nested inside a "
basket
"
# Assume that metadata may be nested inside a "
basket
"
# of multiple eggs; that's why we use module_path instead of .archive
# of multiple eggs and use module_path instead of .archive.
path = self.module_path
eggs = filter(_is_egg_path, _parents(self.module_path))
old = None
egg = next(eggs, None)
while path != old:
egg and self._set_egg(egg)
if _is_egg_path(path):
def _set_egg(self, path):
self.egg_name = os.path.basename(path)
self.egg_name = os.path.basename(path)
self.egg_info = os.path.join(path, 'EGG-INFO')
self.egg_info = os.path.join(path, 'EGG-INFO')
self.egg_root = path
self.egg_root = path
break
old = path
path, base = os.path.split(path)
class DefaultProvider(EggProvider):
class DefaultProvider(EggProvider):
...
...
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