aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-07-13 14:13:54 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-07-13 14:13:54 -0400
commit04a306fa080e8a71f94ea5198b507c501c621cb6 (patch)
treee8cf48586c26f719302136397697ddebdbf2e9af
parent902edffbbab6203a9b3d765485159208fa6e68c3 (diff)
downloadexternal_python_setuptools-04a306fa080e8a71f94ea5198b507c501c621cb6.tar.gz
external_python_setuptools-04a306fa080e8a71f94ea5198b507c501c621cb6.tar.bz2
external_python_setuptools-04a306fa080e8a71f94ea5198b507c501c621cb6.zip
Use makedirs with future compatibility throughout setuptools. Ref #1083.
-rwxr-xr-xsetuptools/command/easy_install.py5
-rwxr-xr-xsetuptools/sandbox.py6
-rw-r--r--setuptools/tests/files.py6
-rw-r--r--setuptools/tests/test_manifest.py4
4 files changed, 11 insertions, 10 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index e319f77c..8fba7b41 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -59,7 +59,7 @@ from pkg_resources import (
Distribution, PathMetadata, EggMetadata, WorkingSet, DistributionNotFound,
VersionConflict, DEVELOP_DIST,
)
-import pkg_resources
+import pkg_resources.py31compat
# Turn on PEP440Warnings
warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
@@ -544,8 +544,7 @@ class easy_install(Command):
if ok_exists:
os.unlink(ok_file)
dirname = os.path.dirname(ok_file)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
+ pkg_resources.py31compat.makedirs(dirname, exist_ok=True)
f = open(pth_file, 'w')
except (OSError, IOError):
self.cant_write_to_target()
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index f99c13c4..1d981f49 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -12,7 +12,7 @@ import textwrap
from setuptools.extern import six
from setuptools.extern.six.moves import builtins, map
-import pkg_resources
+import pkg_resources.py31compat
if sys.platform.startswith('java'):
import org.python.modules.posix.PosixModule as _os
@@ -26,6 +26,7 @@ _open = open
from distutils.errors import DistutilsError
from pkg_resources import working_set
+
__all__ = [
"AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup",
]
@@ -73,8 +74,7 @@ def override_temp(replacement):
"""
Monkey-patch tempfile.tempdir with replacement, ensuring it exists
"""
- if not os.path.isdir(replacement):
- os.makedirs(replacement)
+ pkg_resources.py31compat.makedirs(replacement, exist_ok=True)
saved = tempfile.tempdir
diff --git a/setuptools/tests/files.py b/setuptools/tests/files.py
index 4364241b..98de9fc3 100644
--- a/setuptools/tests/files.py
+++ b/setuptools/tests/files.py
@@ -1,6 +1,9 @@
import os
+import pkg_resources.py31compat
+
+
def build_files(file_defs, prefix=""):
"""
Build a set of files/directories, as described by the file_defs dictionary.
@@ -24,8 +27,7 @@ def build_files(file_defs, prefix=""):
for name, contents in file_defs.items():
full_name = os.path.join(prefix, name)
if isinstance(contents, dict):
- if not os.path.exists(full_name):
- os.makedirs(full_name)
+ pkg_resources.py31compat.makedirs(full_name, exist_ok=True)
build_files(contents, prefix=full_name)
else:
with open(full_name, 'w') as f:
diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py
index ab9b3469..65eec7d9 100644
--- a/setuptools/tests/test_manifest.py
+++ b/setuptools/tests/test_manifest.py
@@ -10,6 +10,7 @@ import itertools
from distutils import log
from distutils.errors import DistutilsTemplateError
+import pkg_resources.py31compat
from setuptools.command.egg_info import FileList, egg_info, translate_pattern
from setuptools.dist import Distribution
from setuptools.extern import six
@@ -361,8 +362,7 @@ class TestFileListTest(TempDirTestCase):
for file in files:
file = os.path.join(self.temp_dir, file)
dirname, basename = os.path.split(file)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
+ pkg_resources.py31compat.makedirs(dirname, exist_ok=True)
open(file, 'w').close()
def test_process_template_line(self):