mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	gh-85454: Remove distutils.ccompiler from Tools/c-analyzer (GH-95171)
This commit is contained in:
		
							parent
							
								
									4a1dd73431
								
							
						
					
					
						commit
						a15ae19ffb
					
				
					 1 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,7 +1,9 @@
 | 
				
			||||||
import contextlib
 | 
					import contextlib
 | 
				
			||||||
import distutils.ccompiler
 | 
					 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
import os.path
 | 
					import os.path
 | 
				
			||||||
 | 
					import re
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from c_common.fsutil import match_glob as _match_glob
 | 
					from c_common.fsutil import match_glob as _match_glob
 | 
				
			||||||
from c_common.tables import parse_table as _parse_table
 | 
					from c_common.tables import parse_table as _parse_table
 | 
				
			||||||
| 
						 | 
					@ -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):
 | 
					def _get_preprocessor(tool):
 | 
				
			||||||
    if tool is True:
 | 
					    if tool is True:
 | 
				
			||||||
        tool = distutils.ccompiler.get_default_compiler()
 | 
					        tool = _get_default_compiler()
 | 
				
			||||||
    preprocess = _COMPILERS.get(tool)
 | 
					    preprocess = _COMPILERS.get(tool)
 | 
				
			||||||
    if preprocess is None:
 | 
					    if preprocess is None:
 | 
				
			||||||
        raise ValueError(f'unsupported tool {tool}')
 | 
					        raise ValueError(f'unsupported tool {tool}')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue