44import importlib ._bootstrap
55import importlib .machinery
66import importlib .util
7+ import logging
78import os
89import re
910import sys
4445 DeprecationWarning
4546 )
4647
47- from distutils import log
4848 from distutils .command .build_ext import build_ext
4949 from distutils .command .build_scripts import build_scripts
5050 from distutils .command .install import install
6464LIST_MODULE_NAMES = False
6565
6666
67+ logging .basicConfig (format = '%(message)s' , level = logging .INFO )
68+ log = logging .getLogger ('setup' )
69+
70+
6771def get_platform ():
6872 # Cross compiling
6973 if "_PYTHON_HOST_PLATFORM" in os .environ :
@@ -241,6 +245,7 @@ def grep_headers_for(function, headers):
241245 return True
242246 return False
243247
248+
244249def find_file (filename , std_dirs , paths ):
245250 """Searches for the directory where a given file is located,
246251 and returns a possibly-empty list of additional directories, or None
@@ -259,23 +264,23 @@ def find_file(filename, std_dirs, paths):
259264 sysroot = macosx_sdk_root ()
260265
261266 # Check the standard locations
262- for dir in std_dirs :
263- f = os .path .join (dir , filename )
267+ for dir_ in std_dirs :
268+ f = os .path .join (dir_ , filename )
264269
265- if MACOS and is_macosx_sdk_path (dir ):
266- f = os .path .join (sysroot , dir [1 :], filename )
270+ if MACOS and is_macosx_sdk_path (dir_ ):
271+ f = os .path .join (sysroot , dir_ [1 :], filename )
267272
268273 if os .path .exists (f ): return []
269274
270275 # Check the additional directories
271- for dir in paths :
272- f = os .path .join (dir , filename )
276+ for dir_ in paths :
277+ f = os .path .join (dir_ , filename )
273278
274- if MACOS and is_macosx_sdk_path (dir ):
275- f = os .path .join (sysroot , dir [1 :], filename )
279+ if MACOS and is_macosx_sdk_path (dir_ ):
280+ f = os .path .join (sysroot , dir_ [1 :], filename )
276281
277282 if os .path .exists (f ):
278- return [dir ]
283+ return [dir_ ]
279284
280285 # Not found anywhere
281286 return None
@@ -333,6 +338,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
333338 else :
334339 assert False , "Internal error: Path not found in std_dirs or paths"
335340
341+
336342def validate_tzpath ():
337343 base_tzpath = sysconfig .get_config_var ('TZPATH' )
338344 if not base_tzpath :
@@ -345,15 +351,16 @@ def validate_tzpath():
345351 + f'found:\n { tzpaths !r} \n with invalid paths:\n '
346352 + f'{ bad_paths !r} ' )
347353
354+
348355def find_module_file (module , dirlist ):
349356 """Find a module in a set of possible folders. If it is not found
350357 return the unadorned filename"""
351- list = find_file (module , [], dirlist )
352- if not list :
358+ dirs = find_file (module , [], dirlist )
359+ if not dirs :
353360 return module
354- if len (list ) > 1 :
355- log .info ("WARNING: multiple copies of %s found" , module )
356- return os .path .join (list [0 ], module )
361+ if len (dirs ) > 1 :
362+ log .info (f "WARNING: multiple copies of { module } found" )
363+ return os .path .join (dirs [0 ], module )
357364
358365
359366class PyBuildExt (build_ext ):
@@ -2667,7 +2674,7 @@ def copy_scripts(self):
26672674 newfilename = filename + fullversion
26682675 else :
26692676 newfilename = filename + minoronly
2670- log .info ('renaming %s to %s' , filename , newfilename )
2677+ log .info (f 'renaming { filename } to { newfilename } ' )
26712678 os .rename (filename , newfilename )
26722679 newoutfiles .append (newfilename )
26732680 if filename in updated_files :
0 commit comments