summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-09-17 16:40:01 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-09-17 16:40:01 (GMT)
commit9c379bbadd7b7cb292fa8ae0a2ad22dd80518b27 (patch)
treef64819d4ac1eaeb765d542a2fb011262e1aa4ca9
parentd12df5e29781e00cdbcc5a4e0824306ee015930b (diff)
downloadcpython-9c379bbadd7b7cb292fa8ae0a2ad22dd80518b27.zip
cpython-9c379bbadd7b7cb292fa8ae0a2ad22dd80518b27.tar.gz
cpython-9c379bbadd7b7cb292fa8ae0a2ad22dd80518b27.tar.bz2
Merged revisions 84861 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84861 | senthil.kumaran | 2010-09-17 22:05:37 +0530 (Fri, 17 Sep 2010) | 3 lines Fix Issue2236: Distutils' mkpath implementation ignoring the "mode" parameter ........
-rw-r--r--Lib/distutils/dir_util.py2
-rw-r--r--Lib/distutils/tests/test_dir_util.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index 9b4d2ad..5a96806 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -68,7 +68,7 @@ def mkpath(name, mode=0777, verbose=1, dry_run=0):
if not dry_run:
try:
- os.mkdir(head)
+ os.mkdir(head, mode)
created_dirs.append(head)
except OSError, exc:
raise DistutilsFileError, \
diff --git a/Lib/distutils/tests/test_dir_util.py b/Lib/distutils/tests/test_dir_util.py
index 0f694aa..8986ca5 100644
--- a/Lib/distutils/tests/test_dir_util.py
+++ b/Lib/distutils/tests/test_dir_util.py
@@ -1,6 +1,7 @@
"""Tests for distutils.dir_util."""
import unittest
import os
+import stat
import shutil
from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree,
@@ -48,6 +49,12 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
wanted = ["removing '%s' (and everything under it)" % self.root_target]
self.assertEquals(self._logs, wanted)
+ def test_mkpath_with_custom_mode(self):
+ mkpath(self.target, 0o700)
+ self.assertEqual(stat.S_IMODE(os.stat(self.target).st_mode), 0o700)
+ mkpath(self.target2, 0o555)
+ self.assertEqual(stat.S_IMODE(os.stat(self.target2).st_mode), 0o555)
+
def test_create_tree_verbosity(self):
create_tree(self.root_target, ['one', 'two', 'three'], verbose=0)