Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
be6cbfb7
Commit
be6cbfb7
authored
Apr 29, 2019
by
Victor Stinner
Committed by
GitHub
Apr 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35952: Sync test.pythoninfo from master (GH-13010)
parent
f4edd390
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
8 deletions
+65
-8
Lib/test/pythoninfo.py
Lib/test/pythoninfo.py
+65
-8
No files found.
Lib/test/pythoninfo.py
View file @
be6cbfb7
...
@@ -6,6 +6,7 @@ import errno
...
@@ -6,6 +6,7 @@ import errno
import
re
import
re
import
sys
import
sys
import
traceback
import
traceback
import
warnings
def
normalize_text
(
text
):
def
normalize_text
(
text
):
...
@@ -142,7 +143,11 @@ def collect_platform(info_add):
...
@@ -142,7 +143,11 @@ def collect_platform(info_add):
info_add('
platform
.
python_implementation
',
info_add('
platform
.
python_implementation
',
platform.python_implementation())
platform.python_implementation())
info_add('
platform
.
platform
',
info_add('
platform
.
platform
',
platform.platform(aliased=True, terse=True))
platform.platform(aliased=True))
libc_ver = ('
%
s
%
s
' % platform.libc_ver()).strip()
if libc_ver:
info_add('
platform
.
libc_ver
', libc_ver)
def collect_locale(info_add):
def collect_locale(info_add):
...
@@ -376,9 +381,17 @@ def collect_time(info_add):
...
@@ -376,9 +381,17 @@ def collect_time(info_add):
copy_attributes
(
info_add
,
time
,
'time.%s'
,
attributes
)
copy_attributes
(
info_add
,
time
,
'time.%s'
,
attributes
)
if
hasattr
(
time
,
'get_clock_info'
):
if
hasattr
(
time
,
'get_clock_info'
):
for
clock
in
(
'time'
,
'perf_counter'
):
for
clock
in
(
'clock'
,
'monotonic'
,
'perf_counter'
,
tinfo
=
time
.
get_clock_info
(
clock
)
'process_time'
,
'thread_time'
,
'time'
):
info_add
(
'time.get_clock_info(%s)'
%
clock
,
tinfo
)
try
:
# prevent DeprecatingWarning on get_clock_info('clock')
with
warnings
.
catch_warnings
(
record
=
True
):
clock_info
=
time
.
get_clock_info
(
clock
)
except
ValueError
:
# missing clock like time.thread_time()
pass
else
:
info_add
(
'time.get_clock_info(%s)'
%
clock
,
clock_info
)
def
collect_datetime
(
info_add
):
def
collect_datetime
(
info_add
):
...
@@ -407,7 +420,10 @@ def collect_sysconfig(info_add):
...
@@ -407,7 +420,10 @@ def collect_sysconfig(info_add):
'OPT'
,
'OPT'
,
'PY_CFLAGS'
,
'PY_CFLAGS'
,
'PY_CFLAGS_NODIST'
,
'PY_CFLAGS_NODIST'
,
'PY_CORE_LDFLAGS'
,
'PY_LDFLAGS'
,
'PY_LDFLAGS'
,
'PY_LDFLAGS_NODIST'
,
'PY_STDMODULE_CFLAGS'
,
'Py_DEBUG'
,
'Py_DEBUG'
,
'Py_ENABLE_SHARED'
,
'Py_ENABLE_SHARED'
,
'SHELL'
,
'SHELL'
,
...
@@ -513,6 +529,8 @@ def collect_resource(info_add):
...
@@ -513,6 +529,8 @@ def collect_resource(info_add):
value
=
resource
.
getrlimit
(
key
)
value
=
resource
.
getrlimit
(
key
)
info_add
(
'resource.%s'
%
name
,
value
)
info_add
(
'resource.%s'
%
name
,
value
)
call_func
(
info_add
,
'resource.pagesize'
,
resource
,
'getpagesize'
)
def
collect_test_socket
(
info_add
):
def
collect_test_socket
(
info_add
):
try
:
try
:
...
@@ -553,10 +571,17 @@ def collect_cc(info_add):
...
@@ -553,10 +571,17 @@ def collect_cc(info_add):
except
ImportError
:
except
ImportError
:
args
=
CC
.
split
()
args
=
CC
.
split
()
args
.
append
(
'--version'
)
args
.
append
(
'--version'
)
proc
=
subprocess
.
Popen
(
args
,
try
:
stdout
=
subprocess
.
PIPE
,
proc
=
subprocess
.
Popen
(
args
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
)
except
OSError
:
# Cannot run the compiler, for example when Python has been
# cross-compiled and installed on the target platform where the
# compiler is missing.
return
stdout
=
proc
.
communicate
()[
0
]
stdout
=
proc
.
communicate
()[
0
]
if
proc
.
returncode
:
if
proc
.
returncode
:
# CC --version failed: ignore error
# CC --version failed: ignore error
...
@@ -567,6 +592,35 @@ def collect_cc(info_add):
...
@@ -567,6 +592,35 @@ def collect_cc(info_add):
info_add
(
'CC.version'
,
text
)
info_add
(
'CC.version'
,
text
)
def
collect_gdbm
(
info_add
):
try
:
from
_gdbm
import
_GDBM_VERSION
except
ImportError
:
return
info_add
(
'gdbm.GDBM_VERSION'
,
'.'
.
join
(
map
(
str
,
_GDBM_VERSION
)))
def
collect_get_config
(
info_add
):
# Dump global configuration variables, _PyCoreConfig
# and _PyMainInterpreterConfig
try
:
from
_testinternalcapi
import
get_configs
except
ImportError
:
return
all_configs
=
get_configs
()
for
config_type
in
sorted
(
all_configs
):
config
=
all_configs
[
config_type
]
for
key
in
sorted
(
config
):
info_add
(
'%s[%s]'
%
(
config_type
,
key
),
repr
(
config
[
key
]))
def
collect_subprocess
(
info_add
):
import
subprocess
copy_attributes
(
info_add
,
subprocess
,
'subprocess.%s'
,
(
'_USE_POSIX_SPAWN'
,))
def
collect_info
(
info
):
def
collect_info
(
info
):
error
=
False
error
=
False
info_add
=
info
.
add
info_add
=
info
.
add
...
@@ -594,6 +648,9 @@ def collect_info(info):
...
@@ -594,6 +648,9 @@ def collect_info(info):
collect_testcapi
,
collect_testcapi
,
collect_resource
,
collect_resource
,
collect_cc
,
collect_cc
,
collect_gdbm
,
collect_get_config
,
collect_subprocess
,
# Collecting from tests should be last as they have side effects.
# Collecting from tests should be last as they have side effects.
collect_test_socket
,
collect_test_socket
,
...
...
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