6
6
import re
7
7
import sys
8
8
import traceback
9
+ import warnings
9
10
10
11
11
12
def normalize_text (text ):
@@ -142,7 +143,11 @@ def collect_platform(info_add):
142
143
info_add ('platform.python_implementation' ,
143
144
platform .python_implementation ())
144
145
info_add ('platform.platform' ,
145
- platform .platform (aliased = True , terse = True ))
146
+ platform .platform (aliased = True ))
147
+
148
+ libc_ver = ('%s %s' % platform .libc_ver ()).strip ()
149
+ if libc_ver :
150
+ info_add ('platform.libc_ver' , libc_ver )
146
151
147
152
148
153
def collect_locale (info_add ):
@@ -376,9 +381,17 @@ def collect_time(info_add):
376
381
copy_attributes (info_add , time , 'time.%s' , attributes )
377
382
378
383
if hasattr (time , 'get_clock_info' ):
379
- for clock in ('time' , 'perf_counter' ):
380
- tinfo = time .get_clock_info (clock )
381
- info_add ('time.get_clock_info(%s)' % clock , tinfo )
384
+ for clock in ('clock' , 'monotonic' , 'perf_counter' ,
385
+ 'process_time' , 'thread_time' , 'time' ):
386
+ try :
387
+ # prevent DeprecatingWarning on get_clock_info('clock')
388
+ with warnings .catch_warnings (record = True ):
389
+ clock_info = time .get_clock_info (clock )
390
+ except ValueError :
391
+ # missing clock like time.thread_time()
392
+ pass
393
+ else :
394
+ info_add ('time.get_clock_info(%s)' % clock , clock_info )
382
395
383
396
384
397
def collect_datetime (info_add ):
@@ -407,7 +420,10 @@ def collect_sysconfig(info_add):
407
420
'OPT' ,
408
421
'PY_CFLAGS' ,
409
422
'PY_CFLAGS_NODIST' ,
423
+ 'PY_CORE_LDFLAGS' ,
410
424
'PY_LDFLAGS' ,
425
+ 'PY_LDFLAGS_NODIST' ,
426
+ 'PY_STDMODULE_CFLAGS' ,
411
427
'Py_DEBUG' ,
412
428
'Py_ENABLE_SHARED' ,
413
429
'SHELL' ,
@@ -513,6 +529,8 @@ def collect_resource(info_add):
513
529
value = resource .getrlimit (key )
514
530
info_add ('resource.%s' % name , value )
515
531
532
+ call_func (info_add , 'resource.pagesize' , resource , 'getpagesize' )
533
+
516
534
517
535
def collect_test_socket (info_add ):
518
536
try :
@@ -553,10 +571,17 @@ def collect_cc(info_add):
553
571
except ImportError :
554
572
args = CC .split ()
555
573
args .append ('--version' )
556
- proc = subprocess .Popen (args ,
557
- stdout = subprocess .PIPE ,
558
- stderr = subprocess .STDOUT ,
559
- universal_newlines = True )
574
+ try :
575
+ proc = subprocess .Popen (args ,
576
+ stdout = subprocess .PIPE ,
577
+ stderr = subprocess .STDOUT ,
578
+ universal_newlines = True )
579
+ except OSError :
580
+ # Cannot run the compiler, for example when Python has been
581
+ # cross-compiled and installed on the target platform where the
582
+ # compiler is missing.
583
+ return
584
+
560
585
stdout = proc .communicate ()[0 ]
561
586
if proc .returncode :
562
587
# CC --version failed: ignore error
@@ -567,6 +592,35 @@ def collect_cc(info_add):
567
592
info_add ('CC.version' , text )
568
593
569
594
595
+ def collect_gdbm (info_add ):
596
+ try :
597
+ from _gdbm import _GDBM_VERSION
598
+ except ImportError :
599
+ return
600
+
601
+ info_add ('gdbm.GDBM_VERSION' , '.' .join (map (str , _GDBM_VERSION )))
602
+
603
+
604
+ def collect_get_config (info_add ):
605
+ # Dump global configuration variables, _PyCoreConfig
606
+ # and _PyMainInterpreterConfig
607
+ try :
608
+ from _testinternalcapi import get_configs
609
+ except ImportError :
610
+ return
611
+
612
+ all_configs = get_configs ()
613
+ for config_type in sorted (all_configs ):
614
+ config = all_configs [config_type ]
615
+ for key in sorted (config ):
616
+ info_add ('%s[%s]' % (config_type , key ), repr (config [key ]))
617
+
618
+
619
+ def collect_subprocess (info_add ):
620
+ import subprocess
621
+ copy_attributes (info_add , subprocess , 'subprocess.%s' , ('_USE_POSIX_SPAWN' ,))
622
+
623
+
570
624
def collect_info (info ):
571
625
error = False
572
626
info_add = info .add
@@ -594,6 +648,9 @@ def collect_info(info):
594
648
collect_testcapi ,
595
649
collect_resource ,
596
650
collect_cc ,
651
+ collect_gdbm ,
652
+ collect_get_config ,
653
+ collect_subprocess ,
597
654
598
655
# Collecting from tests should be last as they have side effects.
599
656
collect_test_socket ,
0 commit comments