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
253d03ca
Commit
253d03ca
authored
Jul 01, 2020
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compatibility module to fix failing tests on Python 3.5 due to missing functionality.
parent
71d738a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
3 deletions
+77
-3
distutils/tests/py35compat.py
distutils/tests/py35compat.py
+68
-0
distutils/tests/test_build_clib.py
distutils/tests/test_build_clib.py
+3
-1
distutils/tests/test_config_cmd.py
distutils/tests/test_config_cmd.py
+3
-1
distutils/tests/test_spawn.py
distutils/tests/test_spawn.py
+3
-1
No files found.
distutils/tests/py35compat.py
0 → 100644
View file @
253d03ca
"""
Backward compatibility support for Python 3.5
"""
import
sys
import
test.support
import
subprocess
# copied from Python 3.9 test.support module
def
_missing_compiler_executable
(
cmd_names
=
[]):
"""Check if the compiler components used to build the interpreter exist.
Check for the existence of the compiler executables whose names are listed
in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
and return the first missing executable or None when none is found
missing.
"""
from
distutils
import
ccompiler
,
sysconfig
,
spawn
compiler
=
ccompiler
.
new_compiler
()
sysconfig
.
customize_compiler
(
compiler
)
for
name
in
compiler
.
executables
:
if
cmd_names
and
name
not
in
cmd_names
:
continue
cmd
=
getattr
(
compiler
,
name
)
if
cmd_names
:
assert
cmd
is
not
None
,
\
"the '%s' executable is not configured"
%
name
elif
not
cmd
:
continue
if
spawn
.
find_executable
(
cmd
[
0
])
is
None
:
return
cmd
[
0
]
missing_compiler_executable
=
vars
(
test
.
support
).
setdefault
(
'missing_compiler_executable'
,
_missing_compiler_executable
,
)
try
:
from
test.support
import
unix_shell
except
ImportError
:
# Adapted from Python 3.9 test.support module
is_android
=
hasattr
(
sys
,
'getandroidapilevel'
)
unix_shell
=
(
None
if
sys
.
platform
==
'win32'
else
'/system/bin/sh'
if
is_android
else
'/bin/sh'
)
# copied from Python 3.9 subprocess module
def
_optim_args_from_interpreter_flags
():
"""Return a list of command-line arguments reproducing the current
optimization settings in sys.flags."""
args
=
[]
value
=
sys
.
flags
.
optimize
if
value
>
0
:
args
.
append
(
'-'
+
'O'
*
value
)
return
args
vars
(
subprocess
).
setdefault
(
'_optim_args_from_interpreter_flags'
,
_optim_args_from_interpreter_flags
,
)
distutils/tests/test_build_clib.py
View file @
253d03ca
...
...
@@ -3,7 +3,9 @@ import unittest
import
os
import
sys
from
test.support
import
run_unittest
,
missing_compiler_executable
from
test.support
import
run_unittest
from
.py35compat
import
missing_compiler_executable
from
distutils.command.build_clib
import
build_clib
from
distutils.errors
import
DistutilsSetupError
...
...
distutils/tests/test_config_cmd.py
View file @
253d03ca
...
...
@@ -2,7 +2,9 @@
import
unittest
import
os
import
sys
from
test.support
import
run_unittest
,
missing_compiler_executable
from
test.support
import
run_unittest
from
.py35compat
import
missing_compiler_executable
from
distutils.command.config
import
dump_file
,
config
from
distutils.tests
import
support
...
...
distutils/tests/test_spawn.py
View file @
253d03ca
...
...
@@ -3,9 +3,11 @@ import os
import
stat
import
sys
import
unittest.mock
from
test.support
import
run_unittest
,
unix_shell
from
test.support
import
run_unittest
from
test
import
support
as
test_support
from
.py35compat
import
unix_shell
from
distutils.spawn
import
find_executable
from
distutils.spawn
import
spawn
from
distutils.errors
import
DistutilsExecError
...
...
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