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
bbf825ee
Commit
bbf825ee
authored
Nov 15, 2019
by
Ondřej Súkup
Committed by
GitHub
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix _imp module behaviour if is defined paths in find_spec call
fixes #1896
parent
55994609
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
setuptools/_imp.py
setuptools/_imp.py
+12
-3
No files found.
setuptools/_imp.py
View file @
bbf825ee
...
...
@@ -19,7 +19,10 @@ PY_FROZEN = 7
def
find_module
(
module
,
paths
=
None
):
"""Just like 'imp.find_module()', but with package support"""
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
isinstance
(
paths
,
list
):
spec
=
importlib
.
machinery
.
PathFinder
().
find_spec
(
module
,
paths
)
else
:
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
spec
is
None
:
raise
ImportError
(
"Can't find %s"
%
module
)
if
not
spec
.
has_location
and
hasattr
(
spec
,
'submodule_search_locations'
):
...
...
@@ -60,14 +63,20 @@ def find_module(module, paths=None):
def
get_frozen_object
(
module
,
paths
=
None
):
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
isinstance
(
paths
,
list
):
spec
=
importlib
.
machinery
.
PathFinder
().
find_spec
(
module
,
paths
)
else
:
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
not
spec
:
raise
ImportError
(
"Can't find %s"
%
module
)
return
spec
.
loader
.
get_code
(
module
)
def
get_module
(
module
,
paths
,
info
):
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
isinstance
(
paths
,
list
):
spec
=
importlib
.
machinery
.
PathFinder
().
find_spec
(
module
,
paths
)
else
:
spec
=
importlib
.
util
.
find_spec
(
module
,
paths
)
if
not
spec
:
raise
ImportError
(
"Can't find %s"
%
module
)
return
module_from_spec
(
spec
)
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