From: DongHun Kwak Date: Mon, 14 Jan 2019 01:33:10 +0000 (+0900) Subject: Imported Upstream version 36.1.1 X-Git-Tag: upstream/36.1.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=055246112568f254609325b8577aef3ee56730bf;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 36.1.1 --- diff --git a/CHANGES.rst b/CHANGES.rst index 1bae3f2..487accd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v36.1.1 +------- + +* #1083: Correct ``py31compat.makedirs`` to correctly honor + ``exist_ok`` parameter. +* #1083: Also use makedirs compatibility throughout setuptools. + v36.1.0 ------- diff --git a/bootstrap.py b/bootstrap.py index f3a12c0..8c7d7fc 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -5,6 +5,8 @@ environment by creating a minimal egg-info directory and then invoking the egg-info command to flesh out the egg-info directory. """ +from __future__ import unicode_literals + import os import sys import textwrap diff --git a/pkg_resources/py31compat.py b/pkg_resources/py31compat.py index 28120ca..331a51b 100644 --- a/pkg_resources/py31compat.py +++ b/pkg_resources/py31compat.py @@ -3,15 +3,20 @@ import errno 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 diff --git a/setup.cfg b/setup.cfg index 10eed84..9046b41 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 36.1.0 +current_version = 36.1.1 commit = True tag = True diff --git a/setup.py b/setup.py index c051fc1..42a4c06 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): 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", diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e319f77..8fba7b4 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 f99c13c..1d981f4 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 4364241..98de9fc 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 ab9b346..65eec7d 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):