Add unit test and make corrections to make_dirs_with_absolute_mode

This commit is contained in:
David Stainton 2016-01-21 23:36:47 +01:00 committed by Brian Warner
parent ee44732d03
commit ba35d7262b

View File

@ -179,13 +179,13 @@ def make_dirs_with_absolute_mode(parent, dirname, mode,):
make_dirs(dirname)
os.chmod(dirname, mode)
initial, last = os.path.split(dirname)
if initial == os.path.abspath(parent):
os.chmod(initial, mode)
else:
if os.path.abspath(initial) == os.path.abspath(parent):
return
while initial and initial != os.path.abspath(parent):
else:
os.chmod(initial, mode)
while initial and os.path.abspath(initial) != os.path.abspath(parent):
initial, last = os.path.split(initial)
if initial == os.path.abspath(parent):
if os.path.abspath(initial) == os.path.abspath(parent):
break
else:
os.chmod(initial, mode)