File tree 1 file changed +10
-13
lines changed 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -1012,19 +1012,16 @@ def mkdirs(newdir, mode=0o777):
1012
1012
> mkdir -p NEWDIR
1013
1013
> chmod MODE NEWDIR
1014
1014
"""
1015
- try :
1016
- if not os .path .exists (newdir ):
1017
- parts = os .path .split (newdir )
1018
- for i in range (1 , len (parts ) + 1 ):
1019
- thispart = os .path .join (* parts [:i ])
1020
- if not os .path .exists (thispart ):
1021
- os .makedirs (thispart , mode )
1022
-
1023
- except OSError as err :
1024
- # Reraise the error unless it's about an already existing directory
1025
- if err .errno != errno .EEXIST or not os .path .isdir (newdir ):
1026
- raise
1027
-
1015
+ # this functionality is now in core python as of 3.2
1016
+ # LPY DROP
1017
+ if six .PY3 :
1018
+ os .makedirs (newdir , mode = mode , exist_ok = True )
1019
+ else :
1020
+ try :
1021
+ os .makedirs (newdir , mode = mode )
1022
+ except OSError as exception :
1023
+ if exception .errno != errno .EEXIST :
1024
+ raise
1028
1025
1029
1026
class GetRealpathAndStat (object ):
1030
1027
def __init__ (self ):
You can’t perform that action at this time.
0 commit comments