mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	#5841: add deprecation py3k warning and notice in the docs for commands module.
This commit is contained in:
		
							parent
							
								
									cf5608df81
								
							
						
					
					
						commit
						208b00d03f
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		|  | @ -5,6 +5,12 @@ | ||||||
| .. module:: commands | .. module:: commands | ||||||
|    :platform: Unix |    :platform: Unix | ||||||
|    :synopsis: Utility functions for running external commands. |    :synopsis: Utility functions for running external commands. | ||||||
|  |    :deprecated: | ||||||
|  | 
 | ||||||
|  | .. deprecated:: 2.6 | ||||||
|  |    The :mod:`commands` module has been removed in Python 3.0.  Use the | ||||||
|  |    :mod:`subprocess` module instead. | ||||||
|  | 
 | ||||||
| .. sectionauthor:: Sue Williams <sbw@provis.com> | .. sectionauthor:: Sue Williams <sbw@provis.com> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,6 +18,10 @@ | ||||||
| 
 | 
 | ||||||
|  [Note:  it would be nice to add functions to interpret the exit status.] |  [Note:  it would be nice to add functions to interpret the exit status.] | ||||||
| """ | """ | ||||||
|  | from warnings import warnpy3k | ||||||
|  | warnpy3k("the commands module has been removed in Python 3.0; " | ||||||
|  |          "use the subprocess module instead", stacklevel=2) | ||||||
|  | del warnpy3k | ||||||
| 
 | 
 | ||||||
| __all__ = ["getstatusoutput","getoutput","getstatus"] | __all__ = ["getstatusoutput","getoutput","getstatus"] | ||||||
| 
 | 
 | ||||||
|  | @ -63,8 +67,6 @@ def getstatusoutput(cmd): | ||||||
| # Make command argument from directory and pathname (prefix space, add quotes). | # Make command argument from directory and pathname (prefix space, add quotes). | ||||||
| # | # | ||||||
| def mk2arg(head, x): | def mk2arg(head, x): | ||||||
|     from warnings import warnpy3k |  | ||||||
|     warnpy3k("In 3.x, mk2arg has been removed.") |  | ||||||
|     import os |     import os | ||||||
|     return mkarg(os.path.join(head, x)) |     return mkarg(os.path.join(head, x)) | ||||||
| 
 | 
 | ||||||
|  | @ -77,8 +79,6 @@ def mk2arg(head, x): | ||||||
| # with backslash. | # with backslash. | ||||||
| # | # | ||||||
| def mkarg(x): | def mkarg(x): | ||||||
|     from warnings import warnpy3k |  | ||||||
|     warnpy3k("in 3.x, mkarg has been removed.") |  | ||||||
|     if '\'' not in x: |     if '\'' not in x: | ||||||
|         return ' \'' + x + '\'' |         return ' \'' + x + '\'' | ||||||
|     s = ' "' |     s = ' "' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Brandl
						Georg Brandl