diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-07-31 14:51:14 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-07-31 14:51:14 -0400 |
commit | 224defdd470ae9a987f4eca7da2a84da47f08c4d (patch) | |
tree | dad02f6525fc1fe35eb5e3ac207ba921c9fd60ce /setuptools/_distutils/dir_util.py | |
parent | 5cef9ab648c49c891f434bc0914b5738d81db270 (diff) | |
parent | 129480b92212c4821329caaa626ad3379478e001 (diff) | |
download | python-setuptools-git-224defdd470ae9a987f4eca7da2a84da47f08c4d.tar.gz |
Merge https://github.com/pypa/distutils into distutils-129480b
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, |