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
11ef9a98
Commit
11ef9a98
authored
Sep 14, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress ValueError in fixup_namespace_packages. Fixes #520. Fixes #513.
parent
2388233e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
CHANGES.rst
CHANGES.rst
+3
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+10
-1
No files found.
CHANGES.rst
View file @
11ef9a98
...
@@ -5,6 +5,9 @@ CHANGES
...
@@ -5,6 +5,9 @@ CHANGES
v27
.2.0
v27
.2.0
-------
-------
*
#
520
and
#
513
:
Suppress
ValueErrors
in
fixup_namespace_packages
when
lookup
fails
.
*
Nicer
,
more
consistent
interfaces
for
msvc
monkeypatching
.
*
Nicer
,
more
consistent
interfaces
for
msvc
monkeypatching
.
v27
.1.2
v27
.1.2
...
...
pkg_resources/__init__.py
View file @
11ef9a98
...
@@ -2066,6 +2066,15 @@ def _rebuild_mod_path(orig_path, package_name, module):
...
@@ -2066,6 +2066,15 @@ def _rebuild_mod_path(orig_path, package_name, module):
"""
"""
sys_path = [_normalize_cached(p) for p in sys.path]
sys_path = [_normalize_cached(p) for p in sys.path]
def safe_sys_path_index(entry):
"""
Workaround
for
#520 and #513.
"""
try:
return sys_path.index(entry)
except ValueError:
return float('inf')
def position_in_sys_path(path):
def position_in_sys_path(path):
"""
"""
Return
the
ordinal
of
the
path
based
on
its
position
in
sys
.
path
Return
the
ordinal
of
the
path
based
on
its
position
in
sys
.
path
...
@@ -2073,7 +2082,7 @@ def _rebuild_mod_path(orig_path, package_name, module):
...
@@ -2073,7 +2082,7 @@ def _rebuild_mod_path(orig_path, package_name, module):
path_parts = path.split(os.sep)
path_parts = path.split(os.sep)
module_parts = package_name.count('.') + 1
module_parts = package_name.count('.') + 1
parts = path_parts[:-module_parts]
parts = path_parts[:-module_parts]
return s
ys_path.
index(_normalize_cached(os.sep.join(parts)))
return s
afe_sys_path_
index(_normalize_cached(os.sep.join(parts)))
orig_path.sort(key=position_in_sys_path)
orig_path.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path]
module.__path__[:] = [_normalize_cached(p) for p in orig_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