Skip to content

Commit 3c1ba46

Browse files
committed
fix windows
1 parent 6e8d75e commit 3c1ba46

File tree

3 files changed

+474
-5
lines changed

3 files changed

+474
-5
lines changed

Lib/test/test_site.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -841,21 +841,28 @@ def get_excepted_output(self, *args):
841841
elif site.ENABLE_USER_SITE is None:
842842
return_code = 2
843843
output = os.pathsep.join(buffer)
844-
return return_code, dedent(output).strip()
844+
return return_code, os.path.normpath(dedent(output).strip())
845845
else:
846846
return 10, None
847847

848848
def invoke_command_line(self, *args):
849849
args = [sys.executable, "-m", "site", *args]
850+
env = os.environ.copy()
851+
env["PYTHONUTF8"] = "1"
852+
env["PYTHONIOENCODING"] = "utf-8"
853+
850854
proc = subprocess.Popen(args,
851855
stdout=subprocess.PIPE,
852856
stderr=subprocess.STDOUT,
853-
text=True)
857+
text=True,
858+
env=env,
859+
encoding='utf-8',
860+
errors='replace')
854861
proc.wait()
855862
output = proc.stdout.read()
856863
return_code = proc.returncode
857864
proc.stdout.close()
858-
return return_code, dedent(output).strip()
865+
return return_code, os.path.normpath(dedent(output).strip())
859866

860867
@unittest.skipIf(sys.platform == 'wasi', "Popen not supported on WASI")
861868
def test_no_args(self):
@@ -867,13 +874,11 @@ def test_no_args(self):
867874
self.assertEqual(lines[-4], "]")
868875
excepted_base = f"USER_BASE: '{site.getuserbase()}'" +\
869876
f" ({self.exists(site.getuserbase())})"
870-
print(excepted_base)
871877
self.assertEqual(lines[-3], excepted_base)
872878
excepted_site = f"USER_SITE: '{site.getusersitepackages()}'" +\
873879
f" ({self.exists(site.getusersitepackages())})"
874880
self.assertEqual(lines[-2], excepted_site)
875881
self.assertEqual(lines[-1], f"ENABLE_USER_SITE: {site.ENABLE_USER_SITE}")
876-
877882

878883
@unittest.skipIf(sys.platform == 'wasi', "Popen not supported on WASI")
879884
def test_unknown_args(self):

confdefs.h

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/* confdefs.h */
2+
#define _NETBSD_SOURCE 1
3+
#define __BSD_VISIBLE 1
4+
#define _DARWIN_C_SOURCE 1
5+
#define _PYTHONFRAMEWORK ""
6+
#define _XOPEN_SOURCE 700
7+
#define _XOPEN_SOURCE_EXTENDED 1
8+
#define _POSIX_C_SOURCE 200809L
9+
#define HAVE_STDIO_H 1
10+
#define HAVE_STDLIB_H 1
11+
#define HAVE_STRING_H 1
12+
#define HAVE_INTTYPES_H 1
13+
#define HAVE_STDINT_H 1
14+
#define HAVE_STRINGS_H 1
15+
#define HAVE_SYS_STAT_H 1
16+
#define HAVE_SYS_TYPES_H 1
17+
#define HAVE_UNISTD_H 1
18+
#define HAVE_WCHAR_H 1
19+
#define STDC_HEADERS 1
20+
#define _ALL_SOURCE 1
21+
#define _DARWIN_C_SOURCE 1
22+
#define _GNU_SOURCE 1
23+
#define _HPUX_ALT_XOPEN_SOCKET_API 1
24+
#define _NETBSD_SOURCE 1
25+
#define _OPENBSD_SOURCE 1
26+
#define _POSIX_PTHREAD_SEMANTICS 1
27+
#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
28+
#define __STDC_WANT_IEC_60559_BFP_EXT__ 1
29+
#define __STDC_WANT_IEC_60559_DFP_EXT__ 1
30+
#define __STDC_WANT_IEC_60559_EXT__ 1
31+
#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
32+
#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
33+
#define __STDC_WANT_LIB_EXT2__ 1
34+
#define __STDC_WANT_MATH_SPEC_FUNCS__ 1
35+
#define _TANDEM_SOURCE 1
36+
#define __EXTENSIONS__ 1
37+
#define PY_SUPPORT_TIER 1
38+
#define STDC_HEADERS 1
39+
#define HAVE_ALLOCA_H 1
40+
#define HAVE_ASM_TYPES_H 1
41+
#define HAVE_DLFCN_H 1
42+
#define HAVE_ENDIAN_H 1
43+
#define HAVE_ERRNO_H 1
44+
#define HAVE_FCNTL_H 1
45+
#define HAVE_GRP_H 1
46+
#define HAVE_LANGINFO_H 1
47+
#define HAVE_LIBINTL_H 1
48+
#define HAVE_LINUX_AUXVEC_H 1
49+
#define HAVE_SYS_AUXV_H 1
50+
#define HAVE_LINUX_FS_H 1
51+
#define HAVE_LINUX_LIMITS_H 1
52+
#define HAVE_LINUX_MEMFD_H 1
53+
#define HAVE_LINUX_NETFILTER_IPV4_H 1
54+
#define HAVE_LINUX_RANDOM_H 1
55+
#define HAVE_LINUX_SOUNDCARD_H 1
56+
#define HAVE_LINUX_SCHED_H 1
57+
#define HAVE_LINUX_TIPC_H 1
58+
#define HAVE_LINUX_WAIT_H 1
59+
#define HAVE_NETDB_H 1
60+
#define HAVE_NET_ETHERNET_H 1
61+
#define HAVE_NETINET_IN_H 1
62+
#define HAVE_NETPACKET_PACKET_H 1
63+
#define HAVE_POLL_H 1
64+
#define HAVE_PTHREAD_H 1
65+
#define HAVE_PTY_H 1
66+
#define HAVE_SCHED_H 1
67+
#define HAVE_SETJMP_H 1
68+
#define HAVE_SHADOW_H 1
69+
#define HAVE_SIGNAL_H 1
70+
#define HAVE_SPAWN_H 1
71+
#define HAVE_SYS_EPOLL_H 1
72+
#define HAVE_SYS_EVENTFD_H 1
73+
#define HAVE_SYS_FILE_H 1
74+
#define HAVE_SYS_IOCTL_H 1
75+
#define HAVE_SYS_MMAN_H 1
76+
#define HAVE_SYS_PARAM_H 1
77+
#define HAVE_SYS_PIDFD_H 1
78+
#define HAVE_SYS_POLL_H 1
79+
#define HAVE_SYS_RANDOM_H 1
80+
#define HAVE_SYS_RESOURCE_H 1
81+
#define HAVE_SYS_SELECT_H 1
82+
#define HAVE_SYS_SENDFILE_H 1
83+
#define HAVE_SYS_SOCKET_H 1
84+
#define HAVE_SYS_SOUNDCARD_H 1
85+
#define HAVE_SYS_STAT_H 1
86+
#define HAVE_SYS_STATVFS_H 1
87+
#define HAVE_SYS_SYSCALL_H 1
88+
#define HAVE_SYS_SYSMACROS_H 1
89+
#define HAVE_SYS_TIME_H 1
90+
#define HAVE_SYS_TIMES_H 1
91+
#define HAVE_SYS_TIMERFD_H 1
92+
#define HAVE_SYS_TYPES_H 1
93+
#define HAVE_SYS_UIO_H 1
94+
#define HAVE_SYS_UN_H 1
95+
#define HAVE_SYS_UTSNAME_H 1
96+
#define HAVE_SYS_WAIT_H 1
97+
#define HAVE_SYS_XATTR_H 1
98+
#define HAVE_SYSEXITS_H 1
99+
#define HAVE_SYSLOG_H 1
100+
#define HAVE_TERMIOS_H 1
101+
#define HAVE_UTIME_H 1
102+
#define HAVE_UTMP_H 1
103+
#define HAVE_DIRENT_H 1
104+
#define MAJOR_IN_SYSMACROS 1
105+
#define HAVE_BLUETOOTH_BLUETOOTH_H 1
106+
#define HAVE_NET_IF_H 1
107+
#define HAVE_LINUX_NETLINK_H 1
108+
#define HAVE_LINUX_QRTR_H 1
109+
#define HAVE_LINUX_VM_SOCKETS_H 1
110+
#define HAVE_LINUX_CAN_H 1
111+
#define HAVE_LINUX_CAN_BCM_H 1
112+
#define HAVE_LINUX_CAN_J1939_H 1
113+
#define HAVE_LINUX_CAN_RAW_H 1
114+
#define HAVE_CLOCK_T 1
115+
#define HAVE_MAKEDEV 1
116+
#define HAVE_HTOLE64 1
117+
#define _LARGEFILE_SOURCE 1
118+
#define _FILE_OFFSET_BITS 64
119+
#if defined(SCO_DS)
120+
#undef _OFF_T
121+
#endif
122+
#define RETSIGTYPE void
123+
#define HAVE_SSIZE_T 1
124+
#define HAVE___UINT128_T 1
125+
#define HAVE_GCC_UINT128_T 1
126+
#define SIZEOF_INT 4
127+
#define SIZEOF_LONG 8
128+
#define ALIGNOF_LONG 8
129+
#define SIZEOF_LONG_LONG 8
130+
#define SIZEOF_VOID_P 8
131+
#define SIZEOF_SHORT 2
132+
#define SIZEOF_FLOAT 4
133+
#define SIZEOF_DOUBLE 8
134+
#define SIZEOF_FPOS_T 16
135+
#define SIZEOF_SIZE_T 8
136+
#define ALIGNOF_SIZE_T 8
137+
#define SIZEOF_PID_T 4
138+
#define SIZEOF_UINTPTR_T 8
139+
#define ALIGNOF_MAX_ALIGN_T 16
140+
#define HAVE_LONG_DOUBLE 1
141+
#define SIZEOF_LONG_DOUBLE 16
142+
#define SIZEOF__BOOL 1
143+
#define SIZEOF_OFF_T 8
144+
#define SIZEOF_TIME_T 8
145+
#define SIZEOF_PTHREAD_T 8
146+
#define SIZEOF_PTHREAD_KEY_T 4
147+
#define PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT 1
148+
#define PY_HAVE_PERF_TRAMPOLINE 1
149+
#define HAVE_LIBDL 1
150+
#define HAVE_EXECINFO_H 1
151+
#define HAVE_BACKTRACE 1
152+
#define HAVE_DLADDR1 1
153+
#define HAVE_LINK_H 1
154+
#define HAVE_BACKTRACE 1
155+
#define HAVE_DLADDR1 1
156+
#define HAVE_DLFCN_H 1
157+
#define HAVE_BACKTRACE 1
158+
#define HAVE_DLADDR1 1
159+
#define HAVE_UUID_H 1
160+
#define HAVE_UUID_GENERATE_TIME_SAFE 1
161+
#define HAVE_FFI_PREP_CIF_VAR 1
162+
#define HAVE_FFI_PREP_CLOSURE_LOC 1
163+
#define HAVE_FFI_CLOSURE_ALLOC 1
164+
#define Py_FFI_SUPPORT_C_COMPLEX 1
165+
#define WITH_DECIMAL_CONTEXTVAR 1
166+
#define HAVE_LIBSQLITE3 1
167+
#define HAVE_LIBSQLITE3 1
168+
#define HAVE_LIBSQLITE3 1
169+
#define HAVE_LIBSQLITE3 1
170+
#define HAVE_LIBSQLITE3 1
171+
#define HAVE_LIBSQLITE3 1
172+
#define HAVE_LIBSQLITE3 1
173+
#define HAVE_LIBSQLITE3 1
174+
#define HAVE_LIBSQLITE3 1
175+
#define PY_SQLITE_HAVE_SERIALIZE 1
176+
#define HAVE_GDBM_H 1
177+
#define HAVE_NDBM_H 1
178+
#define _REENTRANT 1
179+
#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1
180+
#define HAVE_PTHREAD_SIGMASK 1
181+
#define HAVE_PTHREAD_GETCPUCLOCKID 1
182+
#define ENABLE_IPV6 1
183+
#define HAVE_LINUX_CAN_RAW_FD_FRAMES 1
184+
#define HAVE_LINUX_CAN_RAW_JOIN_FILTERS 1
185+
#define WITH_DOC_STRINGS 1
186+
#define HAVE_STD_ATOMIC 1
187+
#define HAVE_BUILTIN_ATOMIC 1
188+
#define WITH_MIMALLOC 1
189+
#define WITH_PYMALLOC 1
190+
#define PY_COERCE_C_LOCALE 1
191+
#define HAVE_DLOPEN 1
192+
#define HAVE_DYNAMIC_LOADING 1
193+
#define HAVE_ACCEPT4 1
194+
#define HAVE_ALARM 1
195+
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
196+
#define HAVE_CHMOD 1
197+
#define HAVE_CHOWN 1
198+
#define HAVE_CLOCK 1
199+
#define HAVE_CLOSEFROM 1
200+
#define HAVE_CLOSE_RANGE 1
201+
#define HAVE_CONFSTR 1
202+
#define HAVE_COPY_FILE_RANGE 1
203+
#define HAVE_CTERMID 1
204+
#define HAVE_DLADDR 1
205+
#define HAVE_DUP 1
206+
#define HAVE_DUP3 1
207+
#define HAVE_EXECV 1
208+
#define HAVE_EXPLICIT_BZERO 1
209+
#define HAVE_FACCESSAT 1
210+
#define HAVE_FCHMOD 1
211+
#define HAVE_FCHMODAT 1
212+
#define HAVE_FCHOWN 1
213+
#define HAVE_FCHOWNAT 1
214+
#define HAVE_FDOPENDIR 1
215+
#define HAVE_FEXECVE 1
216+
#define HAVE_FORK 1

0 commit comments

Comments
 (0)