+v36.1.1
+-------
+
+* #1083: Correct ``py31compat.makedirs`` to correctly honor
+ ``exist_ok`` parameter.
+* #1083: Also use makedirs compatibility throughout setuptools.
+
v36.1.0
-------
egg-info command to flesh out the egg-info directory.
"""
+from __future__ import unicode_literals
+
import os
import sys
import textwrap
import sys
-PY32 = sys.version_info >= (3, 2)
-
-
def _makedirs_31(path, exist_ok=False):
try:
os.makedirs(path)
except OSError as exc:
- if exc.errno != errno.EEXIST:
+ if not exist_ok or exc.errno != errno.EEXIST:
raise
-makedirs = os.makedirs if PY32 else _makedirs_31
+# rely on compatibility behavior until mode considerations
+# and exists_ok considerations are disentangled.
+# See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663
+needs_makedirs = (
+ sys.version_info < (3, 2, 5) or
+ (3, 3) <= sys.version_info < (3, 3, 6) or
+ (3, 4) <= sys.version_info < (3, 4, 1)
+)
+makedirs = _makedirs_31 if needs_makedirs else os.makedirs
[bumpversion]
-current_version = 36.1.0
+current_version = 36.1.1
commit = True
tag = True
setup_params = dict(
name="setuptools",
- version="36.1.0",
+ version="36.1.1",
description="Easily download, build, install, upgrade, and uninstall "
"Python packages",
author="Python Packaging Authority",
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)
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()
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
from distutils.errors import DistutilsError
from pkg_resources import working_set
+
__all__ = [
"AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup",
]
"""
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
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.
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:
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
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):