mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Make setup.py less chatty by default.
This is a conservative version of SF patch 504889. It uses the log module instead of calling print in various places, and it ignores the verbose argument passed to many functions and set as an attribute on some objects. Instead, it uses the verbosity set on the logger via the command line. The log module is now preferred over announce() and warn() methods that exist only for backwards compatibility. XXX This checkin changes a lot of modules that have no test suite and aren't exercised by the Python build process. It will need substantial testing.
This commit is contained in:
		
							parent
							
								
									6fa82a3477
								
							
						
					
					
						commit
						cd8a1148e1
					
				
					 32 changed files with 260 additions and 313 deletions
				
			
		|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| import sys, os, string | ||||
| from distutils.errors import * | ||||
| 
 | ||||
| from distutils import log | ||||
| 
 | ||||
| def spawn (cmd, | ||||
|            search_path=1, | ||||
|  | @ -27,19 +27,18 @@ def spawn (cmd, | |||
| 
 | ||||
|     If 'search_path' is true (the default), the system's executable search | ||||
|     path will be used to find the program; otherwise, cmd[0] must be the | ||||
|     exact path to the executable.  If 'verbose' is true, a one-line summary | ||||
|     of the command will be printed before it is run.  If 'dry_run' is true, | ||||
|     exact path to the executable.If 'dry_run' is true, | ||||
|     the command will not actually be run. | ||||
| 
 | ||||
|     Raise DistutilsExecError if running the program fails in any way; just | ||||
|     return on success. | ||||
|     """ | ||||
|     if os.name == 'posix': | ||||
|         _spawn_posix(cmd, search_path, verbose, dry_run) | ||||
|         _spawn_posix(cmd, search_path, dry_run=dry_run) | ||||
|     elif os.name == 'nt': | ||||
|         _spawn_nt(cmd, search_path, verbose, dry_run) | ||||
|         _spawn_nt(cmd, search_path, dry_run=dry_run) | ||||
|     elif os.name == 'os2': | ||||
|         _spawn_os2(cmd, search_path, verbose, dry_run) | ||||
|         _spawn_os2(cmd, search_path, dry_run=dry_run) | ||||
|     else: | ||||
|         raise DistutilsPlatformError, \ | ||||
|               "don't know how to spawn programs on platform '%s'" % os.name | ||||
|  | @ -74,8 +73,7 @@ def _spawn_nt (cmd, | |||
|     if search_path: | ||||
|         # either we find one or it stays the same | ||||
|         executable = find_executable(executable) or executable | ||||
|     if verbose: | ||||
|         print string.join([executable] + cmd[1:], ' ') | ||||
|     log.info(string.join([executable] + cmd[1:], ' ')) | ||||
|     if not dry_run: | ||||
|         # spawn for NT requires a full path to the .exe | ||||
|         try: | ||||
|  | @ -100,8 +98,7 @@ def _spawn_os2 (cmd, | |||
|     if search_path: | ||||
|         # either we find one or it stays the same | ||||
|         executable = find_executable(executable) or executable  | ||||
|     if verbose: | ||||
|         print string.join([executable] + cmd[1:], ' ') | ||||
|     log.info(string.join([executable] + cmd[1:], ' ')) | ||||
|     if not dry_run: | ||||
|         # spawnv for OS/2 EMX requires a full path to the .exe | ||||
|         try: | ||||
|  | @ -122,8 +119,7 @@ def _spawn_posix (cmd, | |||
|                   verbose=0, | ||||
|                   dry_run=0): | ||||
| 
 | ||||
|     if verbose: | ||||
|         print string.join(cmd, ' ') | ||||
|     log.info(string.join(cmd, ' ')) | ||||
|     if dry_run: | ||||
|         return | ||||
|     exec_fn = search_path and os.execvp or os.execv | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Hylton
						Jeremy Hylton