Skip to content

Commit

Permalink
gh-85454: Remove distutils.ccompiler from Tools/c-analyzer (GH-95171)
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Jul 25, 2022
1 parent 4a1dd73 commit a15ae19
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tools/c-analyzer/c_parser/preprocessor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import contextlib
import distutils.ccompiler
import logging
import os
import os.path
import re
import sys

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


def _get_default_compiler():
if re.match('cygwin.*', sys.platform) is not None:
return 'unix'
if os.name == 'nt':
return 'msvc'
return 'unix'


def _get_preprocessor(tool):
if tool is True:
tool = distutils.ccompiler.get_default_compiler()
tool = _get_default_compiler()
preprocess = _COMPILERS.get(tool)
if preprocess is None:
raise ValueError(f'unsupported tool {tool}')
Expand Down

0 comments on commit a15ae19

Please sign in to comment.