1
1
"""
2
2
Collect various information about Python to help debugging test failures.
3
3
"""
4
- from __future__ import print_function
5
4
import errno
6
5
import re
7
6
import sys
8
7
import traceback
9
- import unittest
10
8
import warnings
11
9
12
10
13
- MS_WINDOWS = (sys .platform == 'win32' )
14
-
15
-
16
11
def normalize_text (text ):
17
12
if text is None :
18
13
return None
@@ -493,13 +488,10 @@ def collect_datetime(info_add):
493
488
494
489
495
490
def collect_sysconfig (info_add ):
496
- # On Windows, sysconfig is not reliable to get macros used
497
- # to build Python
498
- if MS_WINDOWS :
499
- return
500
-
501
491
import sysconfig
502
492
493
+ info_add ('sysconfig.is_python_build' , sysconfig .is_python_build ())
494
+
503
495
for name in (
504
496
'ABIFLAGS' ,
505
497
'ANDROID_API_LEVEL' ,
@@ -523,7 +515,9 @@ def collect_sysconfig(info_add):
523
515
'Py_NOGIL' ,
524
516
'SHELL' ,
525
517
'SOABI' ,
518
+ 'abs_builddir' ,
526
519
'prefix' ,
520
+ 'srcdir' ,
527
521
):
528
522
value = sysconfig .get_config_var (name )
529
523
if name == 'ANDROID_API_LEVEL' and not value :
@@ -711,6 +705,7 @@ def collect_resource(info_add):
711
705
712
706
713
707
def collect_test_socket (info_add ):
708
+ import unittest
714
709
try :
715
710
from test import test_socket
716
711
except (ImportError , unittest .SkipTest ):
@@ -896,6 +891,11 @@ def collect_fips(info_add):
896
891
pass
897
892
898
893
894
+ def collect_tempfile (info_add ):
895
+ import tempfile
896
+
897
+ info_add ('tempfile.gettempdir' , tempfile .gettempdir ())
898
+
899
899
def collect_info (info ):
900
900
error = False
901
901
info_add = info .add
@@ -930,6 +930,7 @@ def collect_info(info):
930
930
collect_sysconfig ,
931
931
collect_testcapi ,
932
932
collect_testinternalcapi ,
933
+ collect_tempfile ,
933
934
collect_time ,
934
935
collect_tkinter ,
935
936
collect_windows ,
0 commit comments