summaryrefslogtreecommitdiff
path: root/sphinx/util/fileutil.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-11-16 05:01:54 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2018-11-20 18:37:05 -0800
commit77849f0ef6d80fc636f457c2d8925c4932c406c9 (patch)
tree270f19661ab4fdcf3a53f122688532018262744d /sphinx/util/fileutil.py
parent2cbc921946c20e072965f746090003fe41f5ddf1 (diff)
downloadsphinx-git-77849f0ef6d80fc636f457c2d8925c4932c406c9.tar.gz
Simplify ensuredir() with Python3 stdlib features
- Simplify ensuredir() to equivalent os.makedir(name, exist_ok=True) - Do not check if a directory exists before calling ensuredir() (ensuredir() already handles it) - Add exist_ok argument to path.makedirs() to follow same pattern - Drop unnecessary .exists() check immediately before .isdir() - Add tests for ensuredir
Diffstat (limited to 'sphinx/util/fileutil.py')
-rw-r--r--sphinx/util/fileutil.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py
index 7dc376807..e6e851f92 100644
--- a/sphinx/util/fileutil.py
+++ b/sphinx/util/fileutil.py
@@ -39,7 +39,7 @@ def copy_asset_file(source, destination, context=None, renderer=None):
if not os.path.exists(source):
return
- if os.path.exists(destination) and os.path.isdir(destination):
+ if os.path.isdir(destination):
# Use source filename if destination points a directory
destination = os.path.join(destination, os.path.basename(source))