mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Merged revisions 72727 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72727 | tarek.ziade | 2009-05-17 13:11:57 +0200 (Sun, 17 May 2009) | 1 line removed sys.platform == 'mac' usage in distutils.dir_util ........
This commit is contained in:
		
							parent
							
								
									d2dd51dae9
								
							
						
					
					
						commit
						c81d84ba81
					
				
					 2 changed files with 14 additions and 11 deletions
				
			
		|  | @ -208,14 +208,11 @@ def remove_tree (directory, verbose=1, dry_run=0): | ||||||
|                     exc, "error removing %s: " % directory)) |                     exc, "error removing %s: " % directory)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def ensure_relative (path): | def ensure_relative(path): | ||||||
|     """Take the full path 'path', and make it a relative path so |     """Take the full path 'path', and make it a relative path so | ||||||
|     it can be the second argument to os.path.join(). |     it can be the second argument to os.path.join(). | ||||||
|     """ |     """ | ||||||
|     drive, path = os.path.splitdrive(path) |     drive, path = os.path.splitdrive(path) | ||||||
|     if sys.platform == 'mac': |     if path[0:1] == os.sep: | ||||||
|         return os.sep + path |         path = drive + path[1:] | ||||||
|     else: |     return path | ||||||
|         if path[0:1] == os.sep: |  | ||||||
|             path = drive + path[1:] |  | ||||||
|         return path |  | ||||||
|  |  | ||||||
|  | @ -3,10 +3,8 @@ | ||||||
| import os | import os | ||||||
| import shutil | import shutil | ||||||
| 
 | 
 | ||||||
| from distutils.dir_util import mkpath | from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree, | ||||||
| from distutils.dir_util import remove_tree |                                 ensure_relative) | ||||||
| from distutils.dir_util import create_tree |  | ||||||
| from distutils.dir_util import copy_tree |  | ||||||
| 
 | 
 | ||||||
| from distutils import log | from distutils import log | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
|  | @ -85,6 +83,14 @@ def test_copy_tree_verbosity(self): | ||||||
|         remove_tree(self.root_target, verbose=0) |         remove_tree(self.root_target, verbose=0) | ||||||
|         remove_tree(self.target2, verbose=0) |         remove_tree(self.target2, verbose=0) | ||||||
| 
 | 
 | ||||||
|  |     def test_ensure_relative(self): | ||||||
|  |         if os.sep == '/': | ||||||
|  |             self.assertEquals(ensure_relative('/home/foo'), 'home/foo') | ||||||
|  |             self.assertEquals(ensure_relative('some/path'), 'some/path') | ||||||
|  |         else:   # \\ | ||||||
|  |             self.assertEquals(ensure_relative('c:\\home\\foo'), 'home\\foo') | ||||||
|  |             self.assertEquals(ensure_relative('home\\foo'), 'home\\foo') | ||||||
|  | 
 | ||||||
| def test_suite(): | def test_suite(): | ||||||
|     return unittest.makeSuite(DirUtilTestCase) |     return unittest.makeSuite(DirUtilTestCase) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tarek Ziadé
						Tarek Ziadé