8000 gh-85454: Remove distutils.ccompiler from Tools/c-analyzer (GH-95171) · python/cpython@a15ae19 · GitHub
[go: up one dir, main page]

Skip to content

Commit a15ae19

Browse files
authored
gh-85454: Remove distutils.ccompiler from Tools/c-analyzer (GH-95171)
1 parent 4a1dd73 commit a15ae19

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Tools/c-analyzer/c_parser/preprocessor/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import contextlib
2-
import distutils.ccompiler
32
import logging
3+
import os
44
import os.path
5+
import re
6+
import sys
57

68
from c_common.fsutil import match_glob as _match_glob
79
from c_common.tables import parse_table as _parse_table
@@ -168,9 +170,17 @@ def handling_errors(ignore_exc=None, *, log_err=None):
168170
}
169171

170172

173+
def _get_default_compiler():
174+
if re.match('cygwin.*', sys.platform) is not None:
175+
return 'unix'
176+
if os.name == 'nt':
177+
return 'msvc'
178+
return 'unix'
179+
180+
171181
def _get_preprocessor(tool):
172182
if tool is True:
173-
tool = distutils.ccompiler.get_default_compiler()
183+
tool = _get_default_compiler()
174184
preprocess = _COMPILERS.get(tool)
175185
if preprocess is None:
176186
raise ValueError(f'unsupported tool {tool}')

0 commit comments

Comments
 (0)
0