diff options
Diffstat (limited to 'setuptools/_distutils/dir_util.py')
-rw-r--r-- | setuptools/_distutils/dir_util.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/setuptools/_distutils/dir_util.py b/setuptools/_distutils/dir_util.py index 2c19b983..7a132e31 100644 --- a/setuptools/_distutils/dir_util.py +++ b/setuptools/_distutils/dir_util.py @@ -4,17 +4,15 @@ Utility functions for manipulating directories and directory trees.""" import os import errno -from distutils.errors import DistutilsFileError, DistutilsInternalError +from distutils.errors import DistutilsInternalError, DistutilsFileError from distutils import log # cache for by mkpath() -- in addition to cheapening redundant calls, # eliminates redundant "creating /foo/bar/baz" messages in dry-run mode _path_created = {} -# I don't use os.makedirs because a) it's new to Python 1.5.2, and -# b) it blows up if the directory already exists (I want to silently -# succeed in that case). -def mkpath(name, mode=0o777, verbose=1, dry_run=0): + +def mkpath(name, mode=0o777, verbose=1, dry_run=0): # noqa: C901 """Create a directory and any missing ancestor directories. If the directory already exists (or if 'name' is the empty string, which @@ -23,6 +21,12 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0): (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout. Return the list of directories actually created. + + os.makedirs is not used because: + + a) It's new to Python 1.5.2, and + b) it blows up if the directory already exists (in which case it should + silently succeed). """ global _path_created @@ -100,7 +104,7 @@ def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0): mkpath(dir, mode, verbose=verbose, dry_run=dry_run) -def copy_tree( +def copy_tree( # noqa: C901 src, dst, preserve_mode=1, |