]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
make destinsrc private
authorBenjamin Peterson <benjamin@python.org>
Sat, 7 Feb 2009 19:08:22 +0000 (19:08 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 7 Feb 2009 19:08:22 +0000 (19:08 +0000)
Lib/shutil.py
Lib/test/test_shutil.py

index cfb6646ad64a4c6a23a0ac69eebe393226cb96cc..af965467e423cc1b9fbcce162b2d47027b8e33fc 100644 (file)
@@ -256,7 +256,7 @@ def move(src, dst):
         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 @@ def move(src, dst):
             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):
index 6f65bdf6602134884e62d8aad7e7db1a931227b8..ac37a536c9c6de1d1b96dd1d6c9e4721f785338a 100644 (file)
@@ -346,8 +346,8 @@ class TestMove(unittest.TestCase):
             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 @@ class TestMove(unittest.TestCase):
             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)