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
eb7436b3
Commit
eb7436b3
authored
Jul 08, 2019
by
Anthony Sottile
Committed by
Paul Ganssle
Aug 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some usage of deprecated `imp` module
parent
05f42a2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
changelog.d/479.change.rst
changelog.d/479.change.rst
+1
-0
setuptools/command/build_ext.py
setuptools/command/build_ext.py
+8
-2
setuptools/command/install_lib.py
setuptools/command/install_lib.py
+3
-3
No files found.
changelog.d/479.change.rst
0 → 100644
View file @
eb7436b3
Remove some usage of the deprecated ``imp`` module.
setuptools/command/build_ext.py
View file @
eb7436b3
import
os
import
sys
import
itertools
import
imp
from
distutils.command.build_ext
import
build_ext
as
_du_build_ext
from
distutils.file_util
import
copy_file
from
distutils.ccompiler
import
new_compiler
...
...
@@ -12,6 +11,13 @@ from distutils import log
from
setuptools.extension
import
Library
from
setuptools.extern
import
six
if
six
.
PY2
:
import
imp
EXTENSION_SUFFIXES
=
[
s
for
s
,
_
,
tp
in
imp
.
get_suffixes
()
if
tp
==
imp
.
C_EXTENSION
]
else
:
from
importlib.machinery
import
EXTENSION_SUFFIXES
try
:
# Attempt to use Cython for building extensions, if available
from
Cython.Distutils.build_ext
import
build_ext
as
_build_ext
...
...
@@ -64,7 +70,7 @@ if_dl = lambda s: s if have_rtld else ''
def
get_abi3_suffix
():
"""Return the file extension for an abi3-compliant Extension()"""
for
suffix
,
_
,
_
in
(
s
for
s
in
imp
.
get_suffixes
()
if
s
[
2
]
==
imp
.
C_EXTENSION
)
:
for
suffix
in
EXTENSION_SUFFIXES
:
if
'.abi3'
in
suffix
:
# Unix
return
suffix
elif
suffix
==
'.pyd'
:
# Windows
...
...
setuptools/command/install_lib.py
View file @
eb7436b3
import
os
import
imp
import
sys
from
itertools
import
product
,
starmap
import
distutils.command.install_lib
as
orig
...
...
@@ -74,10 +74,10 @@ class install_lib(orig.install_lib):
yield
'__init__.pyc'
yield
'__init__.pyo'
if
not
hasattr
(
imp
,
'get_tag
'
):
if
not
hasattr
(
sys
,
'implementation
'
):
return
base
=
os
.
path
.
join
(
'__pycache__'
,
'__init__.'
+
imp
.
get_tag
()
)
base
=
os
.
path
.
join
(
'__pycache__'
,
'__init__.'
+
sys
.
implementation
.
cache_tag
)
yield
base
+
'.pyc'
yield
base
+
'.pyo'
yield
base
+
'.opt-1.pyc'
...
...
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