@@ -44,29 +44,23 @@ def wrapper(path, *args, **kwargs):
44
44
45
45
@functools .singledispatch
46
46
@wrapper
47
- def mkpath (name : pathlib .Path , mode = 0o777 , verbose = True , dry_run = False ):
47
+ def mkpath (name : pathlib .Path , mode = 0o777 , verbose = True , dry_run = False ) -> None :
48
48
"""Create a directory and any missing ancestor directories.
49
49
50
50
If the directory already exists (or if 'name' is the empty string, which
51
51
means the current directory, which of course exists), then do nothing.
52
52
Raise DistutilsFileError if unable to create some directory along the way
53
53
(eg. some sub-path exists, but is a file rather than a directory).
54
54
If 'verbose' is true, log the directory created.
55
- Return the list of directories actually created.
56
55
"""
57
56
if verbose and not name .is_dir ():
58
57
log .info ("creating %s" , name )
59
58
60
- ancestry = itertools .chain ((name ,), name .parents )
61
- missing = list (path for path in ancestry if not path .is_dir ())
62
-
63
59
try :
64
60
dry_run or name .mkdir (mode = mode , parents = True , exist_ok = True )
65
61
except OSError as exc :
66
62
raise DistutilsFileError (f"could not create '{ name } ': { exc .args [- 1 ]} " )
67
63
68
- return list (map (str , missing ))
69
-
70
64
71
65
@mkpath .register
72
66
def _ (name : str , * args , ** kwargs ):
0 commit comments