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
33c9d86a
Commit
33c9d86a
authored
Aug 10, 2020
by
Andrew Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change load_module to exec_module
parent
5e60dc50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
setuptools/command/bdist_egg.py
setuptools/command/bdist_egg.py
+4
-3
setuptools/command/build_ext.py
setuptools/command/build_ext.py
+6
-4
No files found.
setuptools/command/bdist_egg.py
View file @
33c9d86a
...
@@ -55,11 +55,12 @@ def write_stub(resource, pyfile):
...
@@ -55,11 +55,12 @@ def write_stub(resource, pyfile):
_stub_template
=
textwrap
.
dedent
(
"""
_stub_template
=
textwrap
.
dedent
(
"""
def __bootstrap__():
def __bootstrap__():
global __bootstrap__, __loader__, __file__
global __bootstrap__, __loader__, __file__
import sys, pkg_resources
import sys, pkg_resources, importlib.util
from importlib.machinery import ExtensionFileLoader
__file__ = pkg_resources.resource_filename(__name__, %r)
__file__ = pkg_resources.resource_filename(__name__, %r)
__loader__ = None; del __bootstrap__, __loader__
__loader__ = None; del __bootstrap__, __loader__
ExtensionFileLoader(__name__,__file__).load_module()
spec = importlib.util.spec_from_file_location(__name__,__file__)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
__bootstrap__()
__bootstrap__()
"""
).
lstrip
()
"""
).
lstrip
()
with
open
(
pyfile
,
'w'
)
as
f
:
with
open
(
pyfile
,
'w'
)
as
f
:
...
...
setuptools/command/build_ext.py
View file @
33c9d86a
...
@@ -254,8 +254,8 @@ class build_ext(_build_ext):
...
@@ -254,8 +254,8 @@ class build_ext(_build_ext):
'
\
n
'
.
join
([
'
\
n
'
.
join
([
"def __bootstrap__():"
,
"def __bootstrap__():"
,
" global __bootstrap__, __file__, __loader__"
,
" global __bootstrap__, __file__, __loader__"
,
" import sys, os, pkg_resources
"
+
if_dl
(
", dl"
),
" import sys, os, pkg_resources
, importlib.util"
+
" from importlib.machinery import ExtensionFileLoader"
,
if_dl
(
", dl"
)
,
" __file__ = pkg_resources.resource_filename"
" __file__ = pkg_resources.resource_filename"
"(__name__,%r)"
"(__name__,%r)"
%
os
.
path
.
basename
(
ext
.
_file_name
),
%
os
.
path
.
basename
(
ext
.
_file_name
),
...
@@ -267,8 +267,10 @@ class build_ext(_build_ext):
...
@@ -267,8 +267,10 @@ class build_ext(_build_ext):
" try:"
,
" try:"
,
" os.chdir(os.path.dirname(__file__))"
,
" os.chdir(os.path.dirname(__file__))"
,
if_dl
(
" sys.setdlopenflags(dl.RTLD_NOW)"
),
if_dl
(
" sys.setdlopenflags(dl.RTLD_NOW)"
),
" ExtensionFileLoader(__name__,"
,
" spec = importlib.util.spec_from_file_location("
,
" __file__).load_module()"
,
" __name__, __file__)"
,
" mod = importlib.util.module_from_spec(spec)"
,
" spec.loader.exec_module(mod)"
,
" finally:"
,
" finally:"
,
if_dl
(
" sys.setdlopenflags(old_flags)"
),
if_dl
(
" sys.setdlopenflags(old_flags)"
),
" os.chdir(old_dir)"
,
" os.chdir(old_dir)"
,
...
...
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