mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Define 'self.force' in the constructor and remove the hack in '__getattr__()'
to account for it not being defined in the constructor.
This commit is contained in:
		
							parent
							
								
									5f8b12f27e
								
							
						
					
					
						commit
						d197a3a12c
					
				
					 1 changed files with 6 additions and 5 deletions
				
			
		|  | @ -59,6 +59,12 @@ def __init__ (self, dist): | |||
|         self._verbose = None | ||||
|         self._dry_run = None | ||||
| 
 | ||||
|         # Some commands define a 'self.force' option to ignore file | ||||
|         # timestamps, but methods defined *here* assume that | ||||
|         # 'self.force' exists for all commands.  So define it here | ||||
|         # just to be safe. | ||||
|         self.force = None | ||||
| 
 | ||||
|         # The 'help' flag is just used for command-line parsing, so | ||||
|         # none of that complicated bureaucracy is needed. | ||||
|         self.help = 0 | ||||
|  | @ -79,11 +85,6 @@ def __getattr__ (self, attr): | |||
|                 return getattr (self.distribution, attr) | ||||
|             else: | ||||
|                 return myval | ||||
| 
 | ||||
|         # Needed because some Command methods assume 'self.force' exists, | ||||
|         # but not all commands define 'self.force'.  Ugh. | ||||
|         elif attr == 'force': | ||||
|             return None | ||||
|         else: | ||||
|             raise AttributeError, attr | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Greg Ward
						Greg Ward