[Python-checkins] r69415 - in python/trunk/Lib: shutil.py test/test_shutil.py

benjamin.peterson python-checkins at python.org
Sat Feb 7 20:08:24 CET 2009


Author: benjamin.peterson
Date: Sat Feb  7 20:08:22 2009
New Revision: 69415

Log:
make destinsrc private

Modified:
   python/trunk/Lib/shutil.py
   python/trunk/Lib/test/test_shutil.py

Modified: python/trunk/Lib/shutil.py
==============================================================================
--- python/trunk/Lib/shutil.py	(original)
+++ python/trunk/Lib/shutil.py	Sat Feb  7 20:08:22 2009
@@ -256,7 +256,7 @@
         os.rename(src, real_dst)
     except OSError:
         if os.path.isdir(src):
-            if destinsrc(src, dst):
+            if _destinsrc(src, dst):
                 raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)
             copytree(src, real_dst, symlinks=True)
             rmtree(src)
@@ -264,7 +264,7 @@
             copy2(src, real_dst)
             os.unlink(src)
 
-def destinsrc(src, dst):
+def _destinsrc(src, dst):
     src = abspath(src)
     dst = abspath(dst)
     if not src.endswith(os.path.sep):

Modified: python/trunk/Lib/test/test_shutil.py
==============================================================================
--- python/trunk/Lib/test/test_shutil.py	(original)
+++ python/trunk/Lib/test/test_shutil.py	Sat Feb  7 20:08:22 2009
@@ -346,8 +346,8 @@
             for src, dst in [('srcdir', 'srcdir/dest')]:
                 src = os.path.join(TESTFN, src)
                 dst = os.path.join(TESTFN, dst)
-                self.assert_(shutil.destinsrc(src, dst),
-                             msg='destinsrc() wrongly concluded that '
+                self.assert_(shutil._destinsrc(src, dst),
+                             msg='_destinsrc() wrongly concluded that '
                              'dst (%s) is not in src (%s)' % (dst, src))
         finally:
             shutil.rmtree(TESTFN, ignore_errors=True)
@@ -358,8 +358,8 @@
             for src, dst in [('srcdir', 'src/dest'), ('srcdir', 'srcdir.new')]:
                 src = os.path.join(TESTFN, src)
                 dst = os.path.join(TESTFN, dst)
-                self.failIf(shutil.destinsrc(src, dst),
-                            msg='destinsrc() wrongly concluded that '
+                self.failIf(shutil._destinsrc(src, dst),
+                            msg='_destinsrc() wrongly concluded that '
                             'dst (%s) is in src (%s)' % (dst, src))
         finally:
             shutil.rmtree(TESTFN, ignore_errors=True)


More information about the Python-checkins mailing list