Skip to content

[3.7] bpo-33692: Update pythoninfo from master #7298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ def format_attr(attr, value):
copy_attributes(info_add, readline, 'readline.%s', attributes,
formatter=format_attr)

if not hasattr(readline, "_READLINE_LIBRARY_VERSION"):
# _READLINE_LIBRARY_VERSION has been added to CPython 3.7
doc = getattr(readline, '__doc__', '')
if 'libedit readline' in doc:
info_add('readline.library', 'libedit readline')
elif 'GNU readline' in doc:
info_add('readline.library', 'GNU readline')


def collect_gdb(info_add):
import subprocess
Expand Down Expand Up @@ -489,6 +497,34 @@ def collect_test_support(info_add):
call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')


def collect_cc(info_add):
import subprocess
import sysconfig

CC = sysconfig.get_config_var('CC')
if not CC:
return

try:
import shlex
args = shlex.split(CC)
except ImportError:
args = CC.split()
args.append('--version')
proc = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True)
stdout = proc.communicate()[0]
if proc.returncode:
# CC --version failed: ignore error
return

text = stdout.splitlines()[0]
text = normalize_text(text)
info_add('CC.version', text)


def collect_info(info):
error = False
info_add = info.add
Expand All @@ -515,6 +551,7 @@ def collect_info(info):
collect_decimal,
collect_testcapi,
collect_resource,
collect_cc,

# Collecting from tests should be last as they have side effects.
collect_test_socket,
Expand Down