From 84c9006110e53c84296a05741edb7b9edd305f12 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Thu, 4 Sep 2014 20:27:48 -0400 Subject: Add a vendored copy of packaging --- setuptools/_vendor/packaging/__about__.py | 31 ++ setuptools/_vendor/packaging/__init__.py | 24 + setuptools/_vendor/packaging/_compat.py | 27 + setuptools/_vendor/packaging/_structures.py | 78 +++ setuptools/_vendor/packaging/version.py | 786 ++++++++++++++++++++++++++++ setuptools/_vendor/vendored.txt | 1 + 6 files changed, 947 insertions(+) create mode 100644 setuptools/_vendor/packaging/__about__.py create mode 100644 setuptools/_vendor/packaging/__init__.py create mode 100644 setuptools/_vendor/packaging/_compat.py create mode 100644 setuptools/_vendor/packaging/_structures.py create mode 100644 setuptools/_vendor/packaging/version.py create mode 100644 setuptools/_vendor/vendored.txt (limited to 'setuptools') diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py new file mode 100644 index 00000000..b64681e4 --- /dev/null +++ b/setuptools/_vendor/packaging/__about__.py @@ -0,0 +1,31 @@ +# Copyright 2014 Donald Stufft +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + +__all__ = [ + "__title__", "__summary__", "__uri__", "__version__", "__author__", + "__email__", "__license__", "__copyright__", +] + +__title__ = "packaging" +__summary__ = "Core utilities for Python packages" +__uri__ = "https://github.com/pypa/packaging" + +__version__ = "14.2" + +__author__ = "Donald Stufft" +__email__ = "donald@stufft.io" + +__license__ = "Apache License, Version 2.0" +__copyright__ = "Copyright 2014 %s" % __author__ diff --git a/setuptools/_vendor/packaging/__init__.py b/setuptools/_vendor/packaging/__init__.py new file mode 100644 index 00000000..c39a8eab --- /dev/null +++ b/setuptools/_vendor/packaging/__init__.py @@ -0,0 +1,24 @@ +# Copyright 2014 Donald Stufft +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + +from .__about__ import ( + __author__, __copyright__, __email__, __license__, __summary__, __title__, + __uri__, __version__ +) + +__all__ = [ + "__title__", "__summary__", "__uri__", "__version__", "__author__", + "__email__", "__license__", "__copyright__", +] diff --git a/setuptools/_vendor/packaging/_compat.py b/setuptools/_vendor/packaging/_compat.py new file mode 100644 index 00000000..f2ff3834 --- /dev/null +++ b/setuptools/_vendor/packaging/_compat.py @@ -0,0 +1,27 @@ +# Copyright 2014 Donald Stufft +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + +import sys + + +PY2 = sys.version_info[0] == 2 +PY3 = sys.version_info[0] == 3 + +# flake8: noqa + +if PY3: + string_types = str, +else: + string_types = basestring, diff --git a/setuptools/_vendor/packaging/_structures.py b/setuptools/_vendor/packaging/_structures.py new file mode 100644 index 00000000..0ae9bb52 --- /dev/null +++ b/setuptools/_vendor/packaging/_structures.py @@ -0,0 +1,78 @@ +# Copyright 2014 Donald Stufft +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + + +class Infinity(object): + + def __repr__(self): + return "Infinity" + + def __hash__(self): + return hash(repr(self)) + + def __lt__(self, other): + return False + + def __le__(self, other): + return False + + def __eq__(self, other): + return isinstance(other, self.__class__) + + def __ne__(self, other): + return not isinstance(other, self.__class__) + + def __gt__(self, other): + return True + + def __ge__(self, other): + return True + + def __neg__(self): + return NegativeInfinity + +Infinity = Infinity() + + +class NegativeInfinity(object): + + def __repr__(self): + return "-Infinity" + + def __hash__(self): + return hash(repr(self)) + + def __lt__(self, other): + return True + + def __le__(self, other): + return True + + def __eq__(self, other): + return isinstance(other, self.__class__) + + def __ne__(self, other): + return not isinstance(other, self.__class__) + + def __gt__(self, other): + return False + + def __ge__(self, other): + return False + + def __neg__(self): + return Infinity + +NegativeInfinity = NegativeInfinity() diff --git a/setuptools/_vendor/packaging/version.py b/setuptools/_vendor/packaging/version.py new file mode 100644 index 00000000..0affe899 --- /dev/null +++ b/setuptools/_vendor/packaging/version.py @@ -0,0 +1,786 @@ +# Copyright 2014 Donald Stufft +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + +import collections +import itertools +import re + +from ._compat import string_types +from ._structures import Infinity + + +__all__ = [ + "parse", "Version", "LegacyVersion", "InvalidVersion", "Specifier", + "InvalidSpecifier", +] + + +_Version = collections.namedtuple( + "_Version", + ["epoch", "release", "dev", "pre", "post", "local"], +) + + +def parse(version): + """ + Parse the given version string and return either a :class:`Version` object + or a :class:`LegacyVersion` object depending on if the given version is + a valid PEP 440 version or a legacy version. + """ + try: + return Version(version) + except InvalidVersion: + return LegacyVersion(version) + + +class InvalidVersion(ValueError): + """ + An invalid version was found, users should refer to PEP 440. + """ + + +class _BaseVersion(object): + + def __hash__(self): + return hash(self._key) + + def __lt__(self, other): + return self._compare(other, lambda s, o: s < o) + + def __le__(self, other): + return self._compare(other, lambda s, o: s <= o) + + def __eq__(self, other): + return self._compare(other, lambda s, o: s == o) + + def __ge__(self, other): + return self._compare(other, lambda s, o: s >= o) + + def __gt__(self, other): + return self._compare(other, lambda s, o: s > o) + + def __ne__(self, other): + return self._compare(other, lambda s, o: s != o) + + def _compare(self, other, method): + if not isinstance(other, _BaseVersion): + return NotImplemented + + return method(self._key, other._key) + + +class LegacyVersion(_BaseVersion): + + def __init__(self, version): + self._version = str(version) + self._key = _legacy_cmpkey(self._version) + + def __str__(self): + return self._version + + def __repr__(self): + return "".format(repr(str(self))) + + @property + def public(self): + return self._version + + @property + def local(self): + return None + + @property + def is_prerelease(self): + return False + + +_legacy_version_component_re = re.compile( + r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE, +) + +_legacy_version_replacement_map = { + "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@", +} + + +def _parse_version_parts(s): + for part in _legacy_version_component_re.split(s): + part = _legacy_version_replacement_map.get(part, part) + + if not part or part == ".": + continue + + if part[:1] in "0123456789": + # pad for numeric comparison + yield part.zfill(8) + else: + yield "*" + part + + # ensure that alpha/beta/candidate are before final + yield "*final" + + +def _legacy_cmpkey(version): + # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch + # greater than or equal to 0. This will effectively put the LegacyVersion, + # which uses the defacto standard originally implemented by setuptools, + # as before all PEP 440 versions. + epoch = -1 + + # This scheme is taken from pkg_resources.parse_version setuptools prior to + # it's adoption of the packaging library. + parts = [] + for part in _parse_version_parts(version.lower()): + if part.startswith("*"): + # remove "-" before a prerelease tag + if part < "*final": + while parts and parts[-1] == "*final-": + parts.pop() + + # remove trailing zeros from each series of numeric parts + while parts and parts[-1] == "00000000": + parts.pop() + + parts.append(part) + parts = tuple(parts) + + return epoch, parts + + +class Version(_BaseVersion): + + _regex = re.compile( + r""" + ^ + \s* + v? + (?: + (?:(?P[0-9]+)!)? # epoch + (?P[0-9]+(?:\.[0-9]+)*) # release segment + (?P
                                          # pre-release
+                [-_\.]?
+                (?P(a|b|c|rc|alpha|beta|pre|preview))
+                [-_\.]?
+                (?P[0-9]+)?
+            )?
+            (?P                                         # post release
+                (?:-(?P[0-9]+))
+                |
+                (?:
+                    [-_\.]?
+                    (?Ppost|rev|r)
+                    [-_\.]?
+                    (?P[0-9]+)?
+                )
+            )?
+            (?P                                          # dev release
+                [-_\.]?
+                (?Pdev)
+                [-_\.]?
+                (?P[0-9]+)?
+            )?
+        )
+        (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+        \s*
+        $
+        """,
+        re.VERBOSE | re.IGNORECASE,
+    )
+
+    def __init__(self, version):
+        # Validate the version and parse it into pieces
+        match = self._regex.search(version)
+        if not match:
+            raise InvalidVersion("Invalid version: '{0}'".format(version))
+
+        # Store the parsed out pieces of the version
+        self._version = _Version(
+            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
+            release=tuple(int(i) for i in match.group("release").split(".")),
+            pre=_parse_letter_version(
+                match.group("pre_l"),
+                match.group("pre_n"),
+            ),
+            post=_parse_letter_version(
+                match.group("post_l"),
+                match.group("post_n1") or match.group("post_n2"),
+            ),
+            dev=_parse_letter_version(
+                match.group("dev_l"),
+                match.group("dev_n"),
+            ),
+            local=_parse_local_version(match.group("local")),
+        )
+
+        # Generate a key which will be used for sorting
+        self._key = _cmpkey(
+            self._version.epoch,
+            self._version.release,
+            self._version.pre,
+            self._version.post,
+            self._version.dev,
+            self._version.local,
+        )
+
+    def __repr__(self):
+        return "".format(repr(str(self)))
+
+    def __str__(self):
+        parts = []
+
+        # Epoch
+        if self._version.epoch != 0:
+            parts.append("{0}!".format(self._version.epoch))
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self._version.release))
+
+        # Pre-release
+        if self._version.pre is not None:
+            parts.append("".join(str(x) for x in self._version.pre))
+
+        # Post-release
+        if self._version.post is not None:
+            parts.append(".post{0}".format(self._version.post[1]))
+
+        # Development release
+        if self._version.dev is not None:
+            parts.append(".dev{0}".format(self._version.dev[1]))
+
+        # Local version segment
+        if self._version.local is not None:
+            parts.append(
+                "+{0}".format(".".join(str(x) for x in self._version.local))
+            )
+
+        return "".join(parts)
+
+    @property
+    def public(self):
+        return str(self).split("+", 1)[0]
+
+    @property
+    def local(self):
+        version_string = str(self)
+        if "+" in version_string:
+            return version_string.split("+", 1)[1]
+
+    @property
+    def is_prerelease(self):
+        return bool(self._version.dev or self._version.pre)
+
+
+def _parse_letter_version(letter, number):
+    if letter:
+        # We consider there to be an implicit 0 in a pre-release if there is
+        # not a numeral associated with it.
+        if number is None:
+            number = 0
+
+        # We normalize any letters to their lower case form
+        letter = letter.lower()
+
+        # We consider some words to be alternate spellings of other words and
+        # in those cases we want to normalize the spellings to our preferred
+        # spelling.
+        if letter == "alpha":
+            letter = "a"
+        elif letter == "beta":
+            letter = "b"
+        elif letter in ["rc", "pre", "preview"]:
+            letter = "c"
+
+        return letter, int(number)
+    if not letter and number:
+        # We assume if we are given a number, but we are not given a letter
+        # then this is using the implicit post release syntax (e.g. 1.0-1)
+        letter = "post"
+
+        return letter, int(number)
+
+
+_local_version_seperators = re.compile(r"[\._-]")
+
+
+def _parse_local_version(local):
+    """
+    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
+    """
+    if local is not None:
+        return tuple(
+            part.lower() if not part.isdigit() else int(part)
+            for part in _local_version_seperators.split(local)
+        )
+
+
+def _cmpkey(epoch, release, pre, post, dev, local):
+    # When we compare a release version, we want to compare it with all of the
+    # trailing zeros removed. So we'll use a reverse the list, drop all the now
+    # leading zeros until we come to something non zero, then take the rest
+    # re-reverse it back into the correct order and make it a tuple and use
+    # that for our sorting key.
+    release = tuple(
+        reversed(list(
+            itertools.dropwhile(
+                lambda x: x == 0,
+                reversed(release),
+            )
+        ))
+    )
+
+    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
+    # We'll do this by abusing the pre segment, but we _only_ want to do this
+    # if there is not a pre or a post segment. If we have one of those then
+    # the normal sorting rules will handle this case correctly.
+    if pre is None and post is None and dev is not None:
+        pre = -Infinity
+    # Versions without a pre-release (except as noted above) should sort after
+    # those with one.
+    elif pre is None:
+        pre = Infinity
+
+    # Versions without a post segment should sort before those with one.
+    if post is None:
+        post = -Infinity
+
+    # Versions without a development segment should sort after those with one.
+    if dev is None:
+        dev = Infinity
+
+    if local is None:
+        # Versions without a local segment should sort before those with one.
+        local = -Infinity
+    else:
+        # Versions with a local segment need that segment parsed to implement
+        # the sorting rules in PEP440.
+        # - Alpha numeric segments sort before numeric segments
+        # - Alpha numeric segments sort lexicographically
+        # - Numeric segments sort numerically
+        # - Shorter versions sort before longer versions when the prefixes
+        #   match exactly
+        local = tuple(
+            (i, "") if isinstance(i, int) else (-Infinity, i)
+            for i in local
+        )
+
+    return epoch, release, pre, post, dev, local
+
+
+class InvalidSpecifier(ValueError):
+    """
+    An invalid specifier was found, users should refer to PEP 440.
+    """
+
+
+class Specifier(object):
+
+    _regex = re.compile(
+        r"""
+        ^
+        \s*
+        (?P(~=|==|!=|<=|>=|<|>|===))
+        (?P
+            (?:
+                # The identity operators allow for an escape hatch that will
+                # do an exact string match of the version you wish to install.
+                # This will not be parsed by PEP 440 and we cannot determine
+                # any semantic meaning from it. This operator is discouraged
+                # but included entirely as an escape hatch.
+                (?<====)  # Only match for the identity operator
+                \s*
+                [^\s]*    # We just match everything, except for whitespace
+                          # since we are only testing for strict identity.
+            )
+            |
+            (?:
+                # The (non)equality operators allow for wild card and local
+                # versions to be specified so we have to define these two
+                # operators separately to enable that.
+                (?<===|!=)            # Only match for equals and not equals
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)*   # release
+                (?:                   # pre release
+                    [-_\.]?
+                    (a|b|c|rc|alpha|beta|pre|preview)
+                    [-_\.]?
+                    [0-9]*
+                )?
+                (?:                   # post release
+                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                )?
+
+                # You cannot use a wild card and a dev or local version
+                # together so group them with a | and make them optional.
+                (?:
+                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
+                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
+                    |
+                    \.\*  # Wild card syntax of .*
+                )?
+            )
+            |
+            (?:
+                # The compatible operator requires at least two digits in the
+                # release segment.
+                (?<=~=)               # Only match for the compatible operator
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
+                (?:                   # pre release
+                    [-_\.]?
+                    (a|b|c|rc|alpha|beta|pre|preview)
+                    [-_\.]?
+                    [0-9]*
+                )?
+                (?:                                   # post release
+                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                )?
+                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
+            )
+            |
+            (?:
+                # All other operators only allow a sub set of what the
+                # (non)equality operators do. Specifically they do not allow
+                # local versions to be specified nor do they allow the prefix
+                # matching wild cards.
+                (?=": "greater_than_equal",
+        "<": "less_than",
+        ">": "greater_than",
+        "===": "arbitrary",
+    }
+
+    def __init__(self, specs="", prereleases=None):
+        # Split on comma to get each individual specification
+        _specs = set()
+        for spec in (s for s in specs.split(",") if s):
+            match = self._regex.search(spec)
+            if not match:
+                raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
+
+            _specs.add(
+                (
+                    match.group("operator").strip(),
+                    match.group("version").strip(),
+                )
+            )
+
+        # Set a frozen set for our specifications
+        self._specs = frozenset(_specs)
+
+        # Store whether or not this Specifier should accept prereleases
+        self._prereleases = prereleases
+
+    def __repr__(self):
+        return "".format(repr(str(self)))
+
+    def __str__(self):
+        return ",".join(["".join(s) for s in sorted(self._specs)])
+
+    def __hash__(self):
+        return hash(self._specs)
+
+    def __and__(self, other):
+        if isinstance(other, string_types):
+            other = Specifier(other)
+        elif not isinstance(other, Specifier):
+            return NotImplemented
+
+        return self.__class__(",".join([str(self), str(other)]))
+
+    def __eq__(self, other):
+        if isinstance(other, string_types):
+            other = Specifier(other)
+        elif not isinstance(other, Specifier):
+            return NotImplemented
+
+        return self._specs == other._specs
+
+    def __ne__(self, other):
+        if isinstance(other, string_types):
+            other = Specifier(other)
+        elif not isinstance(other, Specifier):
+            return NotImplemented
+
+        return self._specs != other._specs
+
+    def _get_operator(self, op):
+        return getattr(self, "_compare_{0}".format(self._operators[op]))
+
+    def _compare_compatible(self, prospective, spec):
+        # Compatible releases have an equivalent combination of >= and ==. That
+        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
+        # implement this in terms of the other specifiers instead of
+        # implementing it ourselves. The only thing we need to do is construct
+        # the other specifiers.
+
+        # We want everything but the last item in the version, but we want to
+        # ignore post and dev releases and we want to treat the pre-release as
+        # it's own separate segment.
+        prefix = ".".join(
+            list(
+                itertools.takewhile(
+                    lambda x: (not x.startswith("post")
+                               and not x.startswith("dev")),
+                    _version_split(spec),
+                )
+            )[:-1]
+        )
+
+        # Add the prefix notation to the end of our string
+        prefix += ".*"
+
+        return (self._get_operator(">=")(prospective, spec)
+                and self._get_operator("==")(prospective, prefix))
+
+    def _compare_equal(self, prospective, spec):
+        # We need special logic to handle prefix matching
+        if spec.endswith(".*"):
+            # Split the spec out by dots, and pretend that there is an implicit
+            # dot in between a release segment and a pre-release segment.
+            spec = _version_split(spec[:-2])  # Remove the trailing .*
+
+            # Split the prospective version out by dots, and pretend that there
+            # is an implicit dot in between a release segment and a pre-release
+            # segment.
+            prospective = _version_split(str(prospective))
+
+            # Shorten the prospective version to be the same length as the spec
+            # so that we can determine if the specifier is a prefix of the
+            # prospective version or not.
+            prospective = prospective[:len(spec)]
+
+            # Pad out our two sides with zeros so that they both equal the same
+            # length.
+            spec, prospective = _pad_version(spec, prospective)
+        else:
+            # Convert our spec string into a Version
+            spec = Version(spec)
+
+            # If the specifier does not have a local segment, then we want to
+            # act as if the prospective version also does not have a local
+            # segment.
+            if not spec.local:
+                prospective = Version(prospective.public)
+
+        return prospective == spec
+
+    def _compare_not_equal(self, prospective, spec):
+        return not self._compare_equal(prospective, spec)
+
+    def _compare_less_than_equal(self, prospective, spec):
+        return prospective <= Version(spec)
+
+    def _compare_greater_than_equal(self, prospective, spec):
+        return prospective >= Version(spec)
+
+    def _compare_less_than(self, prospective, spec):
+        # Less than are defined as exclusive operators, this implies that
+        # pre-releases do not match for the same series as the spec. This is
+        # implemented by making V imply !=V.*.
+        return (prospective > Version(spec)
+                and self._get_operator("!=")(prospective, spec + ".*"))
+
+    def _compare_arbitrary(self, prospective, spec):
+        return str(prospective).lower() == str(spec).lower()
+
+    @property
+    def prereleases(self):
+        # If there is an explicit prereleases set for this, then we'll just
+        # blindly use that.
+        if self._prereleases is not None:
+            return self._prereleases
+
+        # Look at all of our specifiers and determine if they are inclusive
+        # operators, and if they are if they are including an explicit
+        # prerelease.
+        for spec, version in self._specs:
+            if spec in ["==", ">=", "<=", "~="]:
+                # The == specifier can include a trailing .*, if it does we
+                # want to remove before parsing.
+                if spec == "==" and version.endswith(".*"):
+                    version = version[:-2]
+
+                # Parse the version, and if it is a pre-release than this
+                # specifier allows pre-releases.
+                if parse(version).is_prerelease:
+                    return True
+
+        return False
+
+    @prereleases.setter
+    def prereleases(self, value):
+        self._prereleases = value
+
+    def contains(self, item, prereleases=None):
+        # Determine if prereleases are to be allowed or not.
+        if prereleases is None:
+            prereleases = self.prereleases
+
+        # Normalize item to a Version or LegacyVersion, this allows us to have
+        # a shortcut for ``"2.0" in Specifier(">=2")
+        if isinstance(item, (Version, LegacyVersion)):
+            version_item = item
+        else:
+            try:
+                version_item = Version(item)
+            except ValueError:
+                version_item = LegacyVersion(item)
+
+        # Determine if we should be supporting prereleases in this specifier
+        # or not, if we do not support prereleases than we can short circuit
+        # logic if this version is a prereleases.
+        if version_item.is_prerelease and not prereleases:
+            return False
+
+        # Detect if we have any specifiers, if we do not then anything matches
+        # and we can short circuit all this logic.
+        if not self._specs:
+            return True
+
+        # If we're operating on a LegacyVersion, then we can only support
+        # arbitrary comparison so do a quick check to see if the spec contains
+        # any non arbitrary specifiers
+        if isinstance(version_item, LegacyVersion):
+            if any(op != "===" for op, _ in self._specs):
+                return False
+
+        # Ensure that the passed in version matches all of our version
+        # specifiers
+        return all(
+            self._get_operator(op)(
+                version_item if op != "===" else item,
+                spec,
+            )
+            for op, spec, in self._specs
+        )
+
+    def filter(self, iterable, prereleases=None):
+        iterable = list(iterable)
+        yielded = False
+        found_prereleases = []
+
+        kw = {"prereleases": prereleases if prereleases is not None else True}
+
+        # Attempt to iterate over all the values in the iterable and if any of
+        # them match, yield them.
+        for version in iterable:
+            if not isinstance(version, (Version, LegacyVersion)):
+                parsed_version = parse(version)
+            else:
+                parsed_version = version
+
+            if self.contains(parsed_version, **kw):
+                # If our version is a prerelease, and we were not set to allow
+                # prereleases, then we'll store it for later incase nothing
+                # else matches this specifier.
+                if (parsed_version.is_prerelease
+                        and not (prereleases or self.prereleases)):
+                    found_prereleases.append(version)
+                # Either this is not a prerelease, or we should have been
+                # accepting prereleases from the begining.
+                else:
+                    yielded = True
+                    yield version
+
+        # Now that we've iterated over everything, determine if we've yielded
+        # any values, and if we have not and we have any prereleases stored up
+        # then we will go ahead and yield the prereleases.
+        if not yielded and found_prereleases:
+            for version in found_prereleases:
+                yield version
+
+
+_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
+
+
+def _version_split(version):
+    result = []
+    for item in version.split("."):
+        match = _prefix_regex.search(item)
+        if match:
+            result.extend(match.groups())
+        else:
+            result.append(item)
+    return result
+
+
+def _pad_version(left, right):
+    left_split, right_split = [], []
+
+    # Get the release segment of our versions
+    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
+    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
+
+    # Get the rest of our versions
+    left_split.append(left[len(left_split):])
+    right_split.append(left[len(right_split):])
+
+    # Insert our padding
+    left_split.insert(
+        1,
+        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
+    )
+    right_split.insert(
+        1,
+        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
+    )
+
+    return (
+        list(itertools.chain(*left_split)),
+        list(itertools.chain(*right_split)),
+    )
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
new file mode 100644
index 00000000..df383d8b
--- /dev/null
+++ b/setuptools/_vendor/vendored.txt
@@ -0,0 +1 @@
+packaging==14.2
-- 
cgit v1.2.1


From 9382fa0c05e533400613e1c7c0a777cabb463390 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Thu, 4 Sep 2014 21:04:06 -0400
Subject: Implement PEP 440 by using the packaging library

---
 setuptools/_vendor/__init__.py     |  0
 setuptools/command/egg_info.py     |  8 +++++++-
 setuptools/dist.py                 | 21 +++++++++++++++++++++
 setuptools/tests/test_egg_info.py  |  6 +++---
 setuptools/tests/test_resources.py | 34 ++++++++++++----------------------
 5 files changed, 43 insertions(+), 26 deletions(-)
 create mode 100644 setuptools/_vendor/__init__.py

(limited to 'setuptools')

diff --git a/setuptools/_vendor/__init__.py b/setuptools/_vendor/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 72493d0b..cb67255b 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -15,6 +15,7 @@ from setuptools.command.sdist import sdist
 from setuptools.compat import basestring, PY3, StringIO
 from setuptools import svn_utils
 from setuptools.command.sdist import walk_revctrl
+from setuptools._vendor.packaging.version import Version
 from pkg_resources import (
     parse_requirements, safe_name, parse_version,
     safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename)
@@ -68,9 +69,14 @@ class egg_info(Command):
         self.vtags = self.tags()
         self.egg_version = self.tagged_version()
 
+        parsed_version = parse_version(self.egg_version)
+
         try:
+            spec = (
+                "%s==%s" if isinstance(parsed_version, Version) else "%s===%s"
+            )
             list(
-                parse_requirements('%s==%s' % (self.egg_name,
+                parse_requirements(spec % (self.egg_name,
                                                self.egg_version))
             )
         except ValueError:
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 8b36f67c..ae4ff554 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -15,6 +15,7 @@ from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
 
 from setuptools.depends import Require
 from setuptools.compat import basestring, PY2
+from setuptools._vendor.packaging.version import Version, InvalidVersion
 import pkg_resources
 
 def _get_unpatched(cls):
@@ -268,6 +269,26 @@ class Distribution(_Distribution):
             # Some people apparently take "version number" too literally :)
             self.metadata.version = str(self.metadata.version)
 
+        if self.metadata.version is not None:
+            try:
+                normalized_version = str(Version(self.metadata.version))
+                if self.metadata.version != normalized_version:
+                    warnings.warn(
+                        "The version specified requires normalization, "
+                        "consider using '%s' instead of '%s'." % (
+                            normalized_version,
+                            self.metadata.version,
+                        )
+                    )
+                    self.metadata.version = normalized_version
+            except (InvalidVersion, TypeError):
+                warnings.warn(
+                    "The version specified (%r) is an invalid version, this "
+                    "may not work as expected with newer versions of "
+                    "setuptools, pip, and PyPI. Please see PEP 440 for more "
+                    "details." % self.metadata.version
+                )
+
     def parse_command_line(self):
         """Process features after parsing command line options"""
         result = _Distribution.parse_command_line(self)
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 7531e37c..4c4f9456 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -34,7 +34,7 @@ class TestEggInfo(unittest.TestCase):
         entries_f = open(fn, 'wb')
         entries_f.write(entries)
         entries_f.close()
-   
+
     @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
     def test_version_10_format(self):
         """
@@ -140,7 +140,7 @@ class TestSvnDummy(environment.ZippedEnvironment):
 
     @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
     def test_svn_tags(self):
-        code, data = environment.run_setup_py(["egg_info", 
+        code, data = environment.run_setup_py(["egg_info",
                                                "--tag-svn-revision"],
                                               pypath=self.old_cwd,
                                               data_stream=1)
@@ -155,7 +155,7 @@ class TestSvnDummy(environment.ZippedEnvironment):
             infile.close()
             del infile
 
-        self.assertTrue("Version: 0.1.1-r1\n" in read_contents)
+        self.assertTrue("Version: 0.1.1.post1\n" in read_contents)
 
     @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
     def test_no_tags(self):
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 3baa3ab1..9051b414 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -16,6 +16,7 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
 from setuptools.command.easy_install import (get_script_header, is_sh,
     nt_quote_arg)
 from setuptools.compat import StringIO, iteritems, PY3
+from setuptools._vendor.packaging.version import Specifier
 from .py26compat import skipIf
 
 def safe_repr(obj, short=False):
@@ -103,7 +104,7 @@ class DistroTests(TestCase):
     def checkFooPkg(self,d):
         self.assertEqual(d.project_name, "FooPkg")
         self.assertEqual(d.key, "foopkg")
-        self.assertEqual(d.version, "1.3-1")
+        self.assertEqual(d.version, "1.3.post1")
         self.assertEqual(d.py_version, "2.4")
         self.assertEqual(d.platform, "win32")
         self.assertEqual(d.parsed_version, parse_version("1.3-1"))
@@ -120,9 +121,9 @@ class DistroTests(TestCase):
         self.assertEqual(d.platform, None)
 
     def testDistroParse(self):
-        d = dist_from_fn("FooPkg-1.3_1-py2.4-win32.egg")
+        d = dist_from_fn("FooPkg-1.3.post1-py2.4-win32.egg")
         self.checkFooPkg(d)
-        d = dist_from_fn("FooPkg-1.3_1-py2.4-win32.egg-info")
+        d = dist_from_fn("FooPkg-1.3.post1-py2.4-win32.egg-info")
         self.checkFooPkg(d)
 
     def testDistroMetadata(self):
@@ -330,24 +331,15 @@ class RequirementsTests(TestCase):
         self.assertTrue(twist11 not in r)
         self.assertTrue(twist12 in r)
 
-    def testAdvancedContains(self):
-        r, = parse_requirements("Foo>=1.2,<=1.3,==1.9,>2.0,!=2.5,<3.0,==4.5")
-        for v in ('1.2','1.2.2','1.3','1.9','2.0.1','2.3','2.6','3.0c1','4.5'):
-            self.assertTrue(v in r, (v,r))
-        for v in ('1.2c1','1.3.1','1.5','1.9.1','2.0','2.5','3.0','4.0'):
-            self.assertTrue(v not in r, (v,r))
-
     def testOptionsAndHashing(self):
         r1 = Requirement.parse("Twisted[foo,bar]>=1.2")
         r2 = Requirement.parse("Twisted[bar,FOO]>=1.2")
-        r3 = Requirement.parse("Twisted[BAR,FOO]>=1.2.0")
         self.assertEqual(r1,r2)
-        self.assertEqual(r1,r3)
         self.assertEqual(r1.extras, ("foo","bar"))
         self.assertEqual(r2.extras, ("bar","foo"))  # extras are normalized
         self.assertEqual(hash(r1), hash(r2))
         self.assertEqual(
-            hash(r1), hash(("twisted", ((">=",parse_version("1.2")),),
+            hash(r1), hash(("twisted", Specifier(">=1.2"),
                             frozenset(["foo","bar"])))
         )
 
@@ -420,7 +412,7 @@ class ParseTests(TestCase):
         self.assertNotEqual(safe_name("peak.web"), "peak-web")
 
     def testSafeVersion(self):
-        self.assertEqual(safe_version("1.2-1"), "1.2-1")
+        self.assertEqual(safe_version("1.2-1"), "1.2.post1")
         self.assertEqual(safe_version("1.2 alpha"),  "1.2.alpha")
         self.assertEqual(safe_version("2.3.4 20050521"), "2.3.4.20050521")
         self.assertEqual(safe_version("Money$$$Maker"), "Money-Maker")
@@ -454,12 +446,12 @@ class ParseTests(TestCase):
         c('0.4', '0.4.0')
         c('0.4.0.0', '0.4.0')
         c('0.4.0-0', '0.4-0')
-        c('0pl1', '0.0pl1')
+        c('0post1', '0.0post1')
         c('0pre1', '0.0c1')
         c('0.0.0preview1', '0c1')
         c('0.0c1', '0-rc1')
         c('1.2a1', '1.2.a.1')
-        c('1.2...a', '1.2a')
+        c('1.2.a', '1.2a')
 
     def testVersionOrdering(self):
         def c(s1,s2):
@@ -472,16 +464,14 @@ class ParseTests(TestCase):
         c('2.3a1', '2.3')
         c('2.1-1', '2.1-2')
         c('2.1-1', '2.1.1')
-        c('2.1', '2.1pl4')
+        c('2.1', '2.1post4')
         c('2.1a0-20040501', '2.1')
         c('1.1', '02.1')
-        c('A56','B27')
-        c('3.2', '3.2.pl0')
-        c('3.2-1', '3.2pl1')
-        c('3.2pl1', '3.2pl1-1')
+        c('3.2', '3.2.post0')
+        c('3.2post1', '3.2post2')
         c('0.4', '4.0')
         c('0.0.4', '0.4.0')
-        c('0pl1', '0.4pl1')
+        c('0post1', '0.4post1')
         c('2.1.0-rc1','2.1.0')
         c('2.1dev','2.1a0')
 
-- 
cgit v1.2.1


From a9541756f6a12c91704feffec4ddfee859f12c30 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 27 Sep 2014 16:10:17 -0400
Subject: Fix indent

---
 setuptools/command/egg_info.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 9ba719fe..de43bf0c 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -76,8 +76,7 @@ class egg_info(Command):
                 "%s==%s" if isinstance(parsed_version, Version) else "%s===%s"
             )
             list(
-                parse_requirements(spec % (self.egg_name,
-                                               self.egg_version))
+                parse_requirements(spec % (self.egg_name, self.egg_version))
             )
         except ValueError:
             raise distutils.errors.DistutilsOptionError(
-- 
cgit v1.2.1


From 7d9c21a893431798ba77edd62b5490ff4ce47ecf Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 27 Sep 2014 16:13:48 -0400
Subject: Prefer packaging library if available.

---
 setuptools/command/egg_info.py     | 11 +++++++++--
 setuptools/dist.py                 | 14 +++++++++++---
 setuptools/tests/test_resources.py | 10 ++++++++--
 3 files changed, 28 insertions(+), 7 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index de43bf0c..43df87dc 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -10,12 +10,18 @@ import os
 import re
 import sys
 
+try:
+    import packaging.version
+except ImportError:
+    # fallback to vendored version
+    import setuptools._vendor.packaging.version
+    packaging = setuptools._vendor.packaging
+
 from setuptools import Command
 from setuptools.command.sdist import sdist
 from setuptools.compat import basestring, PY3, StringIO
 from setuptools import svn_utils
 from setuptools.command.sdist import walk_revctrl
-from setuptools._vendor.packaging.version import Version
 from pkg_resources import (
     parse_requirements, safe_name, parse_version,
     safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename)
@@ -72,8 +78,9 @@ class egg_info(Command):
         parsed_version = parse_version(self.egg_version)
 
         try:
+            is_version = isinstance(parsed_version, packaging.version.Version)
             spec = (
-                "%s==%s" if isinstance(parsed_version, Version) else "%s===%s"
+                "%s==%s" if is_version else "%s===%s"
             )
             list(
                 parse_requirements(spec % (self.egg_name, self.egg_version))
diff --git a/setuptools/dist.py b/setuptools/dist.py
index ae4ff554..a3a37ee4 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -13,11 +13,18 @@ from distutils.core import Distribution as _Distribution
 from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
     DistutilsSetupError)
 
+try:
+    import packaging.version
+except ImportError:
+    # fallback to vendored version
+    import setuptools._vendor.packaging.version
+    packaging = setuptools._vendor.packaging
+
 from setuptools.depends import Require
 from setuptools.compat import basestring, PY2
-from setuptools._vendor.packaging.version import Version, InvalidVersion
 import pkg_resources
 
+
 def _get_unpatched(cls):
     """Protect against re-patching the distutils if reloaded
 
@@ -271,7 +278,8 @@ class Distribution(_Distribution):
 
         if self.metadata.version is not None:
             try:
-                normalized_version = str(Version(self.metadata.version))
+                ver = packaging.version.Version(self.metadata.version)
+                normalized_version = str(ver)
                 if self.metadata.version != normalized_version:
                     warnings.warn(
                         "The version specified requires normalization, "
@@ -281,7 +289,7 @@ class Distribution(_Distribution):
                         )
                     )
                     self.metadata.version = normalized_version
-            except (InvalidVersion, TypeError):
+            except (packaging.version.InvalidVersion, TypeError):
                 warnings.warn(
                     "The version specified (%r) is an invalid version, this "
                     "may not work as expected with newer versions of "
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 9051b414..8336a85d 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -8,6 +8,13 @@ import tempfile
 import shutil
 from unittest import TestCase
 
+try:
+    import packaging.version
+except ImportError:
+    # fallback to vendored version
+    import setuptools._vendor.packaging.version
+    packaging = setuptools._vendor.packaging
+
 import pkg_resources
 from pkg_resources import (parse_requirements, VersionConflict, parse_version,
     Distribution, EntryPoint, Requirement, safe_version, safe_name,
@@ -16,7 +23,6 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
 from setuptools.command.easy_install import (get_script_header, is_sh,
     nt_quote_arg)
 from setuptools.compat import StringIO, iteritems, PY3
-from setuptools._vendor.packaging.version import Specifier
 from .py26compat import skipIf
 
 def safe_repr(obj, short=False):
@@ -339,7 +345,7 @@ class RequirementsTests(TestCase):
         self.assertEqual(r2.extras, ("bar","foo"))  # extras are normalized
         self.assertEqual(hash(r1), hash(r2))
         self.assertEqual(
-            hash(r1), hash(("twisted", Specifier(">=1.2"),
+            hash(r1), hash(("twisted", packaging.version.Specifier(">=1.2"),
                             frozenset(["foo","bar"])))
         )
 
-- 
cgit v1.2.1


From aa87355981a6475855116f1b663ba654e332b5a7 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 27 Sep 2014 16:24:55 -0400
Subject: Bump to 7.0 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index c974945d..29524eba 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '6.0.2'
+__version__ = '7.0'
-- 
cgit v1.2.1


From 0c1303c12ba7e94eb0f6a7d961828d0ff08ff93a Mon Sep 17 00:00:00 2001
From: "\"W. Trevor King\"" 
Date: Thu, 16 Oct 2014 17:31:16 -0700
Subject: tests.egg_info: Test absolute egg-base install Make sure this copies
 the appropriate metadata into EGG-INFO.  This test currently fails, but the
 next commit fixes setuptools so it will pass.

---
 setuptools/tests/test_egg_info.py | 58 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 4c4f9456..9f813560 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,8 +1,10 @@
 
+import distutils.core
 import os
 import sys
 import tempfile
 import shutil
+import stat
 import unittest
 
 import pkg_resources
@@ -35,6 +37,20 @@ class TestEggInfo(unittest.TestCase):
         entries_f.write(entries)
         entries_f.close()
 
+    def _create_project(self):
+        with open('setup.py', 'w') as f:
+            f.write('from setuptools import setup\n')
+            f.write('\n')
+            f.write('setup(\n')
+            f.write("    name='foo',\n")
+            f.write("    py_modules=['hello'],\n")
+            f.write("    entry_points={'console_scripts': ['hi = hello.run']},\n")
+            f.write('    zip_safe=False,\n')
+            f.write('    )\n')
+        with open('hello.py', 'w') as f:
+            f.write('def run():\n')
+            f.write("    print('hello')\n")
+
     @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
     def test_version_10_format(self):
         """
@@ -81,6 +97,48 @@ class TestEggInfo(unittest.TestCase):
 
         self.assertEqual(rev, '89000')
 
+    def test_egg_base_installed_egg_info(self):
+        self._create_project()
+        temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
+        os.chmod(temp_dir, stat.S_IRWXU)
+        try:
+            paths = {}
+            for dirname in ['home', 'lib', 'scripts', 'data', 'egg-base']:
+                paths[dirname] = os.path.join(temp_dir, dirname)
+                os.mkdir(paths[dirname])
+            config = os.path.join(paths['home'], '.pydistutils.cfg')
+            with open(config, 'w') as f:
+                f.write('[egg_info]\n')
+                f.write('egg-base = %s\n' % paths['egg-base'])
+            environ = os.environ.copy()
+            environ['HOME'] = paths['home']
+            code, data = environment.run_setup_py(
+                cmd=[
+                    'install', '--home', paths['home'],
+                    '--install-lib', paths['lib'],
+                    '--install-scripts', paths['scripts'],
+                    '--install-data', paths['data']],
+                pypath=':'.join([paths['lib'], self.old_cwd]),
+                data_stream=1,
+                env=environ)
+            if code:
+                raise AssertionError(data)
+            egg_info = None
+            for dirpath, dirnames, filenames in os.walk(paths['lib']):
+                if os.path.basename(dirpath) == 'EGG-INFO':
+                    egg_info = sorted(filenames)
+            self.assertEqual(
+                egg_info,
+                ['PKG-INFO',
+                 'SOURCES.txt',
+                 'dependency_links.txt',
+                 'entry_points.txt',
+                 'not-zip-safe',
+                 'top_level.txt'])
+        finally:
+            shutil.rmtree(temp_dir)
+
+
 DUMMY_SOURCE_TXT = """CHANGES.txt
 CONTRIBUTORS.txt
 HISTORY.txt
-- 
cgit v1.2.1


From 76906b7a50726de89307d55690338d0f40a5aadb Mon Sep 17 00:00:00 2001
From: "\"W. Trevor King\"" 
Date: Thu, 16 Oct 2014 17:31:16 -0700
Subject: egg_info: Search egg-base for files to add to the manifest Before
 this commit, this:

  $ mkdir -p /tmp/xyz/{home,lib,scripts,data,egg}
  $ cat >/tmp/xyz/home/.pydistutils.cfg < [egg_info]
  > egg-base = /tmp/xyz/egg
  > EOF
  $ export PYTHONPATH=/tmp/xyz/lib
  $ export HOME=/tmp/xyz/home
  $ setup.py install --home=/tmp/xyz/home --install-lib=/tmp/xyz/lib \
  >   --install-scripts=/tmp/xyz/scripts --install-data=/tmp/xyz/data

drops a lot of metadata, installing only SOURCES.txt and zip-safe
under EGG-INFO.  The problem is that the metadata files are written to
egg-base, but egg-base is not searched when creating the manifest
because it's outside of the current directory.  Work around this by
explicitly searching egg-base with distutils.filelist.findall (which
is really the version monkeypatched in by setuptools/__init__.py).

Since findall records relative paths, prefix the returned paths with
egg-base, so the include_pattern looking for the absolute
ei_cmd.egg_info will match them.
---
 setuptools/command/egg_info.py | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 43df87dc..2318e54d 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -6,6 +6,7 @@ from distutils.filelist import FileList as _FileList
 from distutils.util import convert_path
 from distutils import log
 import distutils.errors
+import distutils.filelist
 import os
 import re
 import sys
@@ -324,6 +325,10 @@ class manifest_maker(sdist):
         elif os.path.exists(self.manifest):
             self.read_manifest()
         ei_cmd = self.get_finalized_command('egg_info')
+        if ei_cmd.egg_base != os.curdir:
+            self.filelist.allfiles.extend([
+                os.path.join(ei_cmd.egg_base, path)
+                for path in distutils.filelist.findall(ei_cmd.egg_base)])
         self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
 
     def prune_file_list(self):
-- 
cgit v1.2.1


From 03048c86ba6f955179cb4dcab5dd2db024609f19 Mon Sep 17 00:00:00 2001
From: "W. Trevor King" 
Date: Thu, 16 Oct 2014 21:49:22 -0700
Subject: egg_info: Split manifest_maker._add_egg_info into its own method

On Sat, Oct 11, 2014 at 04:23:37PM -0000, Jason R. Coombs wrote [1]:
> I suggest implementing the functionality as a separate method with a
> docstring explaining the purpose.

so that's what we have here. The docstring is adapted from the
cbd4f603 (egg_info: Search egg-base for files to add to the manifest,
2014-10-16) commit message.

It's a lot of docs for a single command (although there is a newsted
list comprehension), so I'm fine if you drop this commit before
merging. The motivation behind the lines would still be available in
the version control history:

  $ hg blame -c setuptools/command/egg_info.py | grep -A1 ei_cmd.egg_base
  cbd4f6038604: if ei_cmd.egg_base != os.curdir:
  cbd4f6038604: self.filelist.allfiles.extend([
  cbd4f6038604: os.path.join(ei_cmd.egg_base, path)
  cbd4f6038604: for path in distutils.filelist.findall(ei_cmd.egg_base)])
  80108b046cb6: self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
  $ hg log -vr cbd4f6038604
  changeset: 3163:cbd4f6038604
  ...
  description:
  egg_info: Search egg-base for files to add to the manifest
  Before this commit, this:

    $ mkdir -p /tmp/xyz/{home,lib,scripts,data,egg}
    $ cat >/tmp/xyz/home/.pydistutils.cfg <
Date: Mon, 3 Nov 2014 14:06:44 +0000
Subject: Make egg_info command write out setup requirements

This commit makes the egg_info command write out setup requirements as well
as install requirements, setup requirements are written to a
setup_requires.txt file.

The commit adds a new function write_setup_requirements which uses the
existing _write_requirements function to write setup requirements out to a file
and adds a new entry point to the egg_info.writers group.
---
 setuptools/command/egg_info.py | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 06764a17..78d86981 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -382,6 +382,12 @@ def write_requirements(cmd, basename, filename):
     cmd.write_or_delete_file("requirements", filename, data.getvalue())
 
 
+def write_setup_requirements(cmd, basename, filename):
+    data = StringIO()
+    _write_requirements(data, cmd.distribution.setup_requires)
+    cmd.write_or_delete_file("setup-requirements", filename, data.getvalue())
+
+
 def write_toplevel_names(cmd, basename, filename):
     pkgs = dict.fromkeys(
         [
-- 
cgit v1.2.1


From 4b8fbbf7f064f170b0e0040f44bb528147ddedc9 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Wed, 19 Nov 2014 13:14:19 -0500
Subject: Upgrade packaging to 14.3

---
 setuptools/_vendor/packaging/__about__.py  |   2 +-
 setuptools/_vendor/packaging/_compat.py    |  13 +
 setuptools/_vendor/packaging/specifiers.py | 732 +++++++++++++++++++++++++++++
 setuptools/_vendor/packaging/version.py    | 412 +---------------
 setuptools/_vendor/vendored.txt            |   2 +-
 5 files changed, 748 insertions(+), 413 deletions(-)
 create mode 100644 setuptools/_vendor/packaging/specifiers.py

(limited to 'setuptools')

diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py
index b64681e4..481589e7 100644
--- a/setuptools/_vendor/packaging/__about__.py
+++ b/setuptools/_vendor/packaging/__about__.py
@@ -22,7 +22,7 @@ __title__ = "packaging"
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "14.2"
+__version__ = "14.3"
 
 __author__ = "Donald Stufft"
 __email__ = "donald@stufft.io"
diff --git a/setuptools/_vendor/packaging/_compat.py b/setuptools/_vendor/packaging/_compat.py
index f2ff3834..5c396cea 100644
--- a/setuptools/_vendor/packaging/_compat.py
+++ b/setuptools/_vendor/packaging/_compat.py
@@ -25,3 +25,16 @@ if PY3:
     string_types = str,
 else:
     string_types = basestring,
+
+
+def with_metaclass(meta, *bases):
+    """
+    Create a base class with a metaclass.
+    """
+    # This requires a bit of explanation: the basic idea is to make a dummy
+    # metaclass for one level of class instantiation that replaces itself with
+    # the actual metaclass.
+    class metaclass(meta):
+        def __new__(cls, name, this_bases, d):
+            return meta(name, bases, d)
+    return type.__new__(metaclass, 'temporary_class', (), {})
diff --git a/setuptools/_vendor/packaging/specifiers.py b/setuptools/_vendor/packaging/specifiers.py
new file mode 100644
index 00000000..bea4a398
--- /dev/null
+++ b/setuptools/_vendor/packaging/specifiers.py
@@ -0,0 +1,732 @@
+# Copyright 2014 Donald Stufft
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import absolute_import, division, print_function
+
+import abc
+import functools
+import itertools
+import re
+
+from ._compat import string_types, with_metaclass
+from .version import Version, LegacyVersion, parse
+
+
+class InvalidSpecifier(ValueError):
+    """
+    An invalid specifier was found, users should refer to PEP 440.
+    """
+
+
+class BaseSpecifier(with_metaclass(abc.ABCMeta, object)):
+
+    @abc.abstractmethod
+    def __str__(self):
+        """
+        Returns the str representation of this Specifier like object. This
+        should be representative of the Specifier itself.
+        """
+
+    @abc.abstractmethod
+    def __hash__(self):
+        """
+        Returns a hash value for this Specifier like object.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other):
+        """
+        Returns a boolean representing whether or not the two Specifier like
+        objects are equal.
+        """
+
+    @abc.abstractmethod
+    def __ne__(self, other):
+        """
+        Returns a boolean representing whether or not the two Specifier like
+        objects are not equal.
+        """
+
+    @abc.abstractproperty
+    def prereleases(self):
+        """
+        Returns whether or not pre-releases as a whole are allowed by this
+        specifier.
+        """
+
+    @prereleases.setter
+    def prereleases(self, value):
+        """
+        Sets whether or not pre-releases as a whole are allowed by this
+        specifier.
+        """
+
+    @abc.abstractmethod
+    def contains(self, item, prereleases=None):
+        """
+        Determines if the given item is contained within this specifier.
+        """
+
+    @abc.abstractmethod
+    def filter(self, iterable, prereleases=None):
+        """
+        Takes an iterable of items and filters them so that only items which
+        are contained within this specifier are allowed in it.
+        """
+
+
+class _IndividualSpecifier(BaseSpecifier):
+
+    _operators = {}
+
+    def __init__(self, spec="", prereleases=None):
+        match = self._regex.search(spec)
+        if not match:
+            raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
+
+        self._spec = (
+            match.group("operator").strip(),
+            match.group("version").strip(),
+        )
+
+        # Store whether or not this Specifier should accept prereleases
+        self._prereleases = prereleases
+
+    def __repr__(self):
+        pre = (
+            ", prereleases={0!r}".format(self.prereleases)
+            if self._prereleases is not None
+            else ""
+        )
+
+        return "<{0}({1!r}{2})>".format(
+            self.__class__.__name__,
+            str(self),
+            pre,
+        )
+
+    def __str__(self):
+        return "{0}{1}".format(*self._spec)
+
+    def __hash__(self):
+        return hash(self._spec)
+
+    def __eq__(self, other):
+        if isinstance(other, string_types):
+            try:
+                other = self.__class__(other)
+            except InvalidSpecifier:
+                return NotImplemented
+        elif not isinstance(other, self.__class__):
+            return NotImplemented
+
+        return self._spec == other._spec
+
+    def __ne__(self, other):
+        if isinstance(other, string_types):
+            try:
+                other = self.__class__(other)
+            except InvalidSpecifier:
+                return NotImplemented
+        elif not isinstance(other, self.__class__):
+            return NotImplemented
+
+        return self._spec != other._spec
+
+    def _get_operator(self, op):
+        return getattr(self, "_compare_{0}".format(self._operators[op]))
+
+    def _coerce_version(self, version):
+        if not isinstance(version, (LegacyVersion, Version)):
+            version = parse(version)
+        return version
+
+    @property
+    def prereleases(self):
+        return self._prereleases
+
+    @prereleases.setter
+    def prereleases(self, value):
+        self._prereleases = value
+
+    def contains(self, item, prereleases=None):
+        # Determine if prereleases are to be allowed or not.
+        if prereleases is None:
+            prereleases = self.prereleases
+
+        # Normalize item to a Version or LegacyVersion, this allows us to have
+        # a shortcut for ``"2.0" in Specifier(">=2")
+        item = self._coerce_version(item)
+
+        # Determine if we should be supporting prereleases in this specifier
+        # or not, if we do not support prereleases than we can short circuit
+        # logic if this version is a prereleases.
+        if item.is_prerelease and not prereleases:
+            return False
+
+        # Actually do the comparison to determine if this item is contained
+        # within this Specifier or not.
+        return self._get_operator(self._spec[0])(item, self._spec[1])
+
+    def filter(self, iterable, prereleases=None):
+        yielded = False
+        found_prereleases = []
+
+        kw = {"prereleases": prereleases if prereleases is not None else True}
+
+        # Attempt to iterate over all the values in the iterable and if any of
+        # them match, yield them.
+        for version in iterable:
+            parsed_version = self._coerce_version(version)
+
+            if self.contains(parsed_version, **kw):
+                # If our version is a prerelease, and we were not set to allow
+                # prereleases, then we'll store it for later incase nothing
+                # else matches this specifier.
+                if (parsed_version.is_prerelease
+                        and not (prereleases or self.prereleases)):
+                    found_prereleases.append(version)
+                # Either this is not a prerelease, or we should have been
+                # accepting prereleases from the begining.
+                else:
+                    yielded = True
+                    yield version
+
+        # Now that we've iterated over everything, determine if we've yielded
+        # any values, and if we have not and we have any prereleases stored up
+        # then we will go ahead and yield the prereleases.
+        if not yielded and found_prereleases:
+            for version in found_prereleases:
+                yield version
+
+
+class LegacySpecifier(_IndividualSpecifier):
+
+    _regex = re.compile(
+        r"""
+        ^
+        \s*
+        (?P(==|!=|<=|>=|<|>))
+        \s*
+        (?P
+            [^\s]* # We just match everything, except for whitespace since this
+                   # is a "legacy" specifier and the version string can be just
+                   # about anything.
+        )
+        \s*
+        $
+        """,
+        re.VERBOSE | re.IGNORECASE,
+    )
+
+    _operators = {
+        "==": "equal",
+        "!=": "not_equal",
+        "<=": "less_than_equal",
+        ">=": "greater_than_equal",
+        "<": "less_than",
+        ">": "greater_than",
+    }
+
+    def _coerce_version(self, version):
+        if not isinstance(version, LegacyVersion):
+            version = LegacyVersion(str(version))
+        return version
+
+    def _compare_equal(self, prospective, spec):
+        return prospective == self._coerce_version(spec)
+
+    def _compare_not_equal(self, prospective, spec):
+        return prospective != self._coerce_version(spec)
+
+    def _compare_less_than_equal(self, prospective, spec):
+        return prospective <= self._coerce_version(spec)
+
+    def _compare_greater_than_equal(self, prospective, spec):
+        return prospective >= self._coerce_version(spec)
+
+    def _compare_less_than(self, prospective, spec):
+        return prospective < self._coerce_version(spec)
+
+    def _compare_greater_than(self, prospective, spec):
+        return prospective > self._coerce_version(spec)
+
+
+def _require_version_compare(fn):
+    @functools.wraps(fn)
+    def wrapped(self, prospective, spec):
+        if not isinstance(prospective, Version):
+            return False
+        return fn(self, prospective, spec)
+    return wrapped
+
+
+class Specifier(_IndividualSpecifier):
+
+    _regex = re.compile(
+        r"""
+        ^
+        \s*
+        (?P(~=|==|!=|<=|>=|<|>|===))
+        (?P
+            (?:
+                # The identity operators allow for an escape hatch that will
+                # do an exact string match of the version you wish to install.
+                # This will not be parsed by PEP 440 and we cannot determine
+                # any semantic meaning from it. This operator is discouraged
+                # but included entirely as an escape hatch.
+                (?<====)  # Only match for the identity operator
+                \s*
+                [^\s]*    # We just match everything, except for whitespace
+                          # since we are only testing for strict identity.
+            )
+            |
+            (?:
+                # The (non)equality operators allow for wild card and local
+                # versions to be specified so we have to define these two
+                # operators separately to enable that.
+                (?<===|!=)            # Only match for equals and not equals
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)*   # release
+                (?:                   # pre release
+                    [-_\.]?
+                    (a|b|c|rc|alpha|beta|pre|preview)
+                    [-_\.]?
+                    [0-9]*
+                )?
+                (?:                   # post release
+                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                )?
+
+                # You cannot use a wild card and a dev or local version
+                # together so group them with a | and make them optional.
+                (?:
+                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
+                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
+                    |
+                    \.\*  # Wild card syntax of .*
+                )?
+            )
+            |
+            (?:
+                # The compatible operator requires at least two digits in the
+                # release segment.
+                (?<=~=)               # Only match for the compatible operator
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
+                (?:                   # pre release
+                    [-_\.]?
+                    (a|b|c|rc|alpha|beta|pre|preview)
+                    [-_\.]?
+                    [0-9]*
+                )?
+                (?:                                   # post release
+                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                )?
+                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
+            )
+            |
+            (?:
+                # All other operators only allow a sub set of what the
+                # (non)equality operators do. Specifically they do not allow
+                # local versions to be specified nor do they allow the prefix
+                # matching wild cards.
+                (?=": "greater_than_equal",
+        "<": "less_than",
+        ">": "greater_than",
+        "===": "arbitrary",
+    }
+
+    @_require_version_compare
+    def _compare_compatible(self, prospective, spec):
+        # Compatible releases have an equivalent combination of >= and ==. That
+        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
+        # implement this in terms of the other specifiers instead of
+        # implementing it ourselves. The only thing we need to do is construct
+        # the other specifiers.
+
+        # We want everything but the last item in the version, but we want to
+        # ignore post and dev releases and we want to treat the pre-release as
+        # it's own separate segment.
+        prefix = ".".join(
+            list(
+                itertools.takewhile(
+                    lambda x: (not x.startswith("post")
+                               and not x.startswith("dev")),
+                    _version_split(spec),
+                )
+            )[:-1]
+        )
+
+        # Add the prefix notation to the end of our string
+        prefix += ".*"
+
+        return (self._get_operator(">=")(prospective, spec)
+                and self._get_operator("==")(prospective, prefix))
+
+    @_require_version_compare
+    def _compare_equal(self, prospective, spec):
+        # We need special logic to handle prefix matching
+        if spec.endswith(".*"):
+            # Split the spec out by dots, and pretend that there is an implicit
+            # dot in between a release segment and a pre-release segment.
+            spec = _version_split(spec[:-2])  # Remove the trailing .*
+
+            # Split the prospective version out by dots, and pretend that there
+            # is an implicit dot in between a release segment and a pre-release
+            # segment.
+            prospective = _version_split(str(prospective))
+
+            # Shorten the prospective version to be the same length as the spec
+            # so that we can determine if the specifier is a prefix of the
+            # prospective version or not.
+            prospective = prospective[:len(spec)]
+
+            # Pad out our two sides with zeros so that they both equal the same
+            # length.
+            spec, prospective = _pad_version(spec, prospective)
+        else:
+            # Convert our spec string into a Version
+            spec = Version(spec)
+
+            # If the specifier does not have a local segment, then we want to
+            # act as if the prospective version also does not have a local
+            # segment.
+            if not spec.local:
+                prospective = Version(prospective.public)
+
+        return prospective == spec
+
+    @_require_version_compare
+    def _compare_not_equal(self, prospective, spec):
+        return not self._compare_equal(prospective, spec)
+
+    @_require_version_compare
+    def _compare_less_than_equal(self, prospective, spec):
+        return prospective <= Version(spec)
+
+    @_require_version_compare
+    def _compare_greater_than_equal(self, prospective, spec):
+        return prospective >= Version(spec)
+
+    @_require_version_compare
+    def _compare_less_than(self, prospective, spec):
+        # Less than are defined as exclusive operators, this implies that
+        # pre-releases do not match for the same series as the spec. This is
+        # implemented by making V imply !=V.*.
+        return (prospective > Version(spec)
+                and self._get_operator("!=")(prospective, spec + ".*"))
+
+    def _compare_arbitrary(self, prospective, spec):
+        return str(prospective).lower() == str(spec).lower()
+
+    @property
+    def prereleases(self):
+        # If there is an explicit prereleases set for this, then we'll just
+        # blindly use that.
+        if self._prereleases is not None:
+            return self._prereleases
+
+        # Look at all of our specifiers and determine if they are inclusive
+        # operators, and if they are if they are including an explicit
+        # prerelease.
+        operator, version = self._spec
+        if operator in ["==", ">=", "<=", "~="]:
+            # The == specifier can include a trailing .*, if it does we
+            # want to remove before parsing.
+            if operator == "==" and version.endswith(".*"):
+                version = version[:-2]
+
+            # Parse the version, and if it is a pre-release than this
+            # specifier allows pre-releases.
+            if parse(version).is_prerelease:
+                return True
+
+        return False
+
+    @prereleases.setter
+    def prereleases(self, value):
+        self._prereleases = value
+
+
+_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
+
+
+def _version_split(version):
+    result = []
+    for item in version.split("."):
+        match = _prefix_regex.search(item)
+        if match:
+            result.extend(match.groups())
+        else:
+            result.append(item)
+    return result
+
+
+def _pad_version(left, right):
+    left_split, right_split = [], []
+
+    # Get the release segment of our versions
+    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
+    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
+
+    # Get the rest of our versions
+    left_split.append(left[len(left_split):])
+    right_split.append(left[len(right_split):])
+
+    # Insert our padding
+    left_split.insert(
+        1,
+        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
+    )
+    right_split.insert(
+        1,
+        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
+    )
+
+    return (
+        list(itertools.chain(*left_split)),
+        list(itertools.chain(*right_split)),
+    )
+
+
+class SpecifierSet(BaseSpecifier):
+
+    def __init__(self, specifiers="", prereleases=None):
+        # Split on , to break each indidivual specifier into it's own item, and
+        # strip each item to remove leading/trailing whitespace.
+        specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
+
+        # Parsed each individual specifier, attempting first to make it a
+        # Specifier and falling back to a LegacySpecifier.
+        parsed = set()
+        for specifier in specifiers:
+            try:
+                parsed.add(Specifier(specifier))
+            except InvalidSpecifier:
+                parsed.add(LegacySpecifier(specifier))
+
+        # Turn our parsed specifiers into a frozen set and save them for later.
+        self._specs = frozenset(parsed)
+
+        # Store our prereleases value so we can use it later to determine if
+        # we accept prereleases or not.
+        self._prereleases = prereleases
+
+    def __repr__(self):
+        pre = (
+            ", prereleases={0!r}".format(self.prereleases)
+            if self._prereleases is not None
+            else ""
+        )
+
+        return "".format(str(self), pre)
+
+    def __str__(self):
+        return ",".join(sorted(str(s) for s in self._specs))
+
+    def __hash__(self):
+        return hash(self._specs)
+
+    def __and__(self, other):
+        if isinstance(other, string_types):
+            other = SpecifierSet(other)
+        elif not isinstance(other, SpecifierSet):
+            return NotImplemented
+
+        specifier = SpecifierSet()
+        specifier._specs = frozenset(self._specs | other._specs)
+
+        if self._prereleases is None and other._prereleases is not None:
+            specifier._prereleases = other._prereleases
+        elif self._prereleases is not None and other._prereleases is None:
+            specifier._prereleases = self._prereleases
+        elif self._prereleases == other._prereleases:
+            specifier._prereleases = self._prereleases
+        else:
+            raise ValueError(
+                "Cannot combine SpecifierSets with True and False prerelease "
+                "overrides."
+            )
+
+        return specifier
+
+    def __eq__(self, other):
+        if isinstance(other, string_types):
+            other = SpecifierSet(other)
+        elif isinstance(other, _IndividualSpecifier):
+            other = SpecifierSet(str(other))
+        elif not isinstance(other, SpecifierSet):
+            return NotImplemented
+
+        return self._specs == other._specs
+
+    def __ne__(self, other):
+        if isinstance(other, string_types):
+            other = SpecifierSet(other)
+        elif isinstance(other, _IndividualSpecifier):
+            other = SpecifierSet(str(other))
+        elif not isinstance(other, SpecifierSet):
+            return NotImplemented
+
+        return self._specs != other._specs
+
+    @property
+    def prereleases(self):
+        # If we have been given an explicit prerelease modifier, then we'll
+        # pass that through here.
+        if self._prereleases is not None:
+            return self._prereleases
+
+        # Otherwise we'll see if any of the given specifiers accept
+        # prereleases, if any of them do we'll return True, otherwise False.
+        # Note: The use of any() here means that an empty set of specifiers
+        #       will always return False, this is an explicit design decision.
+        return any(s.prereleases for s in self._specs)
+
+    @prereleases.setter
+    def prereleases(self, value):
+        self._prereleases = value
+
+    def contains(self, item, prereleases=None):
+        # Ensure that our item is a Version or LegacyVersion instance.
+        if not isinstance(item, (LegacyVersion, Version)):
+            item = parse(item)
+
+        # We can determine if we're going to allow pre-releases by looking to
+        # see if any of the underlying items supports them. If none of them do
+        # and this item is a pre-release then we do not allow it and we can
+        # short circuit that here.
+        # Note: This means that 1.0.dev1 would not be contained in something
+        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0
+        if (not (self.prereleases or prereleases)) and item.is_prerelease:
+            return False
+
+        # Determine if we're forcing a prerelease or not, we bypass
+        # self.prereleases here and use self._prereleases because we want to
+        # only take into consideration actual *forced* values. The underlying
+        # specifiers will handle the other logic.
+        # The logic here is: If prereleases is anything but None, we'll just
+        #                    go aheand and continue to use that. However if
+        #                    prereleases is None, then we'll use whatever the
+        #                    value of self._prereleases is as long as it is not
+        #                    None itself.
+        if prereleases is None and self._prereleases is not None:
+            prereleases = self._prereleases
+
+        # We simply dispatch to the underlying specs here to make sure that the
+        # given version is contained within all of them.
+        # Note: This use of all() here means that an empty set of specifiers
+        #       will always return True, this is an explicit design decision.
+        return all(
+            s.contains(item, prereleases=prereleases)
+            for s in self._specs
+        )
+
+    def filter(self, iterable, prereleases=None):
+        # Determine if we're forcing a prerelease or not, we bypass
+        # self.prereleases here and use self._prereleases because we want to
+        # only take into consideration actual *forced* values. The underlying
+        # specifiers will handle the other logic.
+        # The logic here is: If prereleases is anything but None, we'll just
+        #                    go aheand and continue to use that. However if
+        #                    prereleases is None, then we'll use whatever the
+        #                    value of self._prereleases is as long as it is not
+        #                    None itself.
+        if prereleases is None and self._prereleases is not None:
+            prereleases = self._prereleases
+
+        # If we have any specifiers, then we want to wrap our iterable in the
+        # filter method for each one, this will act as a logical AND amongst
+        # each specifier.
+        if self._specs:
+            for spec in self._specs:
+                iterable = spec.filter(iterable, prereleases=prereleases)
+            return iterable
+        # If we do not have any specifiers, then we need to have a rough filter
+        # which will filter out any pre-releases, unless there are no final
+        # releases, and which will filter out LegacyVersion in general.
+        else:
+            filtered = []
+            found_prereleases = []
+
+            for item in iterable:
+                # Ensure that we some kind of Version class for this item.
+                if not isinstance(item, (LegacyVersion, Version)):
+                    parsed_version = parse(item)
+                else:
+                    parsed_version = item
+
+                # Filter out any item which is parsed as a LegacyVersion
+                if isinstance(parsed_version, LegacyVersion):
+                    continue
+
+                # Store any item which is a pre-release for later unless we've
+                # already found a final version or we are accepting prereleases
+                if parsed_version.is_prerelease and not prereleases:
+                    if not filtered:
+                        found_prereleases.append(item)
+                else:
+                    filtered.append(item)
+
+            # If we've found no items except for pre-releases, then we'll go
+            # ahead and use the pre-releases
+            if not filtered and found_prereleases and prereleases is None:
+                return found_prereleases
+
+            return filtered
diff --git a/setuptools/_vendor/packaging/version.py b/setuptools/_vendor/packaging/version.py
index 0affe899..e76e9607 100644
--- a/setuptools/_vendor/packaging/version.py
+++ b/setuptools/_vendor/packaging/version.py
@@ -17,13 +17,11 @@ import collections
 import itertools
 import re
 
-from ._compat import string_types
 from ._structures import Infinity
 
 
 __all__ = [
-    "parse", "Version", "LegacyVersion", "InvalidVersion", "Specifier",
-    "InvalidSpecifier",
+    "parse", "Version", "LegacyVersion", "InvalidVersion",
 ]
 
 
@@ -376,411 +374,3 @@ def _cmpkey(epoch, release, pre, post, dev, local):
         )
 
     return epoch, release, pre, post, dev, local
-
-
-class InvalidSpecifier(ValueError):
-    """
-    An invalid specifier was found, users should refer to PEP 440.
-    """
-
-
-class Specifier(object):
-
-    _regex = re.compile(
-        r"""
-        ^
-        \s*
-        (?P(~=|==|!=|<=|>=|<|>|===))
-        (?P
-            (?:
-                # The identity operators allow for an escape hatch that will
-                # do an exact string match of the version you wish to install.
-                # This will not be parsed by PEP 440 and we cannot determine
-                # any semantic meaning from it. This operator is discouraged
-                # but included entirely as an escape hatch.
-                (?<====)  # Only match for the identity operator
-                \s*
-                [^\s]*    # We just match everything, except for whitespace
-                          # since we are only testing for strict identity.
-            )
-            |
-            (?:
-                # The (non)equality operators allow for wild card and local
-                # versions to be specified so we have to define these two
-                # operators separately to enable that.
-                (?<===|!=)            # Only match for equals and not equals
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)*   # release
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-
-                # You cannot use a wild card and a dev or local version
-                # together so group them with a | and make them optional.
-                (?:
-                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
-                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
-                    |
-                    \.\*  # Wild card syntax of .*
-                )?
-            )
-            |
-            (?:
-                # The compatible operator requires at least two digits in the
-                # release segment.
-                (?<=~=)               # Only match for the compatible operator
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
-            )
-            |
-            (?:
-                # All other operators only allow a sub set of what the
-                # (non)equality operators do. Specifically they do not allow
-                # local versions to be specified nor do they allow the prefix
-                # matching wild cards.
-                (?=": "greater_than_equal",
-        "<": "less_than",
-        ">": "greater_than",
-        "===": "arbitrary",
-    }
-
-    def __init__(self, specs="", prereleases=None):
-        # Split on comma to get each individual specification
-        _specs = set()
-        for spec in (s for s in specs.split(",") if s):
-            match = self._regex.search(spec)
-            if not match:
-                raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
-
-            _specs.add(
-                (
-                    match.group("operator").strip(),
-                    match.group("version").strip(),
-                )
-            )
-
-        # Set a frozen set for our specifications
-        self._specs = frozenset(_specs)
-
-        # Store whether or not this Specifier should accept prereleases
-        self._prereleases = prereleases
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    def __str__(self):
-        return ",".join(["".join(s) for s in sorted(self._specs)])
-
-    def __hash__(self):
-        return hash(self._specs)
-
-    def __and__(self, other):
-        if isinstance(other, string_types):
-            other = Specifier(other)
-        elif not isinstance(other, Specifier):
-            return NotImplemented
-
-        return self.__class__(",".join([str(self), str(other)]))
-
-    def __eq__(self, other):
-        if isinstance(other, string_types):
-            other = Specifier(other)
-        elif not isinstance(other, Specifier):
-            return NotImplemented
-
-        return self._specs == other._specs
-
-    def __ne__(self, other):
-        if isinstance(other, string_types):
-            other = Specifier(other)
-        elif not isinstance(other, Specifier):
-            return NotImplemented
-
-        return self._specs != other._specs
-
-    def _get_operator(self, op):
-        return getattr(self, "_compare_{0}".format(self._operators[op]))
-
-    def _compare_compatible(self, prospective, spec):
-        # Compatible releases have an equivalent combination of >= and ==. That
-        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
-        # implement this in terms of the other specifiers instead of
-        # implementing it ourselves. The only thing we need to do is construct
-        # the other specifiers.
-
-        # We want everything but the last item in the version, but we want to
-        # ignore post and dev releases and we want to treat the pre-release as
-        # it's own separate segment.
-        prefix = ".".join(
-            list(
-                itertools.takewhile(
-                    lambda x: (not x.startswith("post")
-                               and not x.startswith("dev")),
-                    _version_split(spec),
-                )
-            )[:-1]
-        )
-
-        # Add the prefix notation to the end of our string
-        prefix += ".*"
-
-        return (self._get_operator(">=")(prospective, spec)
-                and self._get_operator("==")(prospective, prefix))
-
-    def _compare_equal(self, prospective, spec):
-        # We need special logic to handle prefix matching
-        if spec.endswith(".*"):
-            # Split the spec out by dots, and pretend that there is an implicit
-            # dot in between a release segment and a pre-release segment.
-            spec = _version_split(spec[:-2])  # Remove the trailing .*
-
-            # Split the prospective version out by dots, and pretend that there
-            # is an implicit dot in between a release segment and a pre-release
-            # segment.
-            prospective = _version_split(str(prospective))
-
-            # Shorten the prospective version to be the same length as the spec
-            # so that we can determine if the specifier is a prefix of the
-            # prospective version or not.
-            prospective = prospective[:len(spec)]
-
-            # Pad out our two sides with zeros so that they both equal the same
-            # length.
-            spec, prospective = _pad_version(spec, prospective)
-        else:
-            # Convert our spec string into a Version
-            spec = Version(spec)
-
-            # If the specifier does not have a local segment, then we want to
-            # act as if the prospective version also does not have a local
-            # segment.
-            if not spec.local:
-                prospective = Version(prospective.public)
-
-        return prospective == spec
-
-    def _compare_not_equal(self, prospective, spec):
-        return not self._compare_equal(prospective, spec)
-
-    def _compare_less_than_equal(self, prospective, spec):
-        return prospective <= Version(spec)
-
-    def _compare_greater_than_equal(self, prospective, spec):
-        return prospective >= Version(spec)
-
-    def _compare_less_than(self, prospective, spec):
-        # Less than are defined as exclusive operators, this implies that
-        # pre-releases do not match for the same series as the spec. This is
-        # implemented by making V imply !=V.*.
-        return (prospective > Version(spec)
-                and self._get_operator("!=")(prospective, spec + ".*"))
-
-    def _compare_arbitrary(self, prospective, spec):
-        return str(prospective).lower() == str(spec).lower()
-
-    @property
-    def prereleases(self):
-        # If there is an explicit prereleases set for this, then we'll just
-        # blindly use that.
-        if self._prereleases is not None:
-            return self._prereleases
-
-        # Look at all of our specifiers and determine if they are inclusive
-        # operators, and if they are if they are including an explicit
-        # prerelease.
-        for spec, version in self._specs:
-            if spec in ["==", ">=", "<=", "~="]:
-                # The == specifier can include a trailing .*, if it does we
-                # want to remove before parsing.
-                if spec == "==" and version.endswith(".*"):
-                    version = version[:-2]
-
-                # Parse the version, and if it is a pre-release than this
-                # specifier allows pre-releases.
-                if parse(version).is_prerelease:
-                    return True
-
-        return False
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-    def contains(self, item, prereleases=None):
-        # Determine if prereleases are to be allowed or not.
-        if prereleases is None:
-            prereleases = self.prereleases
-
-        # Normalize item to a Version or LegacyVersion, this allows us to have
-        # a shortcut for ``"2.0" in Specifier(">=2")
-        if isinstance(item, (Version, LegacyVersion)):
-            version_item = item
-        else:
-            try:
-                version_item = Version(item)
-            except ValueError:
-                version_item = LegacyVersion(item)
-
-        # Determine if we should be supporting prereleases in this specifier
-        # or not, if we do not support prereleases than we can short circuit
-        # logic if this version is a prereleases.
-        if version_item.is_prerelease and not prereleases:
-            return False
-
-        # Detect if we have any specifiers, if we do not then anything matches
-        # and we can short circuit all this logic.
-        if not self._specs:
-            return True
-
-        # If we're operating on a LegacyVersion, then we can only support
-        # arbitrary comparison so do a quick check to see if the spec contains
-        # any non arbitrary specifiers
-        if isinstance(version_item, LegacyVersion):
-            if any(op != "===" for op, _ in self._specs):
-                return False
-
-        # Ensure that the passed in version matches all of our version
-        # specifiers
-        return all(
-            self._get_operator(op)(
-                version_item if op != "===" else item,
-                spec,
-            )
-            for op, spec, in self._specs
-        )
-
-    def filter(self, iterable, prereleases=None):
-        iterable = list(iterable)
-        yielded = False
-        found_prereleases = []
-
-        kw = {"prereleases": prereleases if prereleases is not None else True}
-
-        # Attempt to iterate over all the values in the iterable and if any of
-        # them match, yield them.
-        for version in iterable:
-            if not isinstance(version, (Version, LegacyVersion)):
-                parsed_version = parse(version)
-            else:
-                parsed_version = version
-
-            if self.contains(parsed_version, **kw):
-                # If our version is a prerelease, and we were not set to allow
-                # prereleases, then we'll store it for later incase nothing
-                # else matches this specifier.
-                if (parsed_version.is_prerelease
-                        and not (prereleases or self.prereleases)):
-                    found_prereleases.append(version)
-                # Either this is not a prerelease, or we should have been
-                # accepting prereleases from the begining.
-                else:
-                    yielded = True
-                    yield version
-
-        # Now that we've iterated over everything, determine if we've yielded
-        # any values, and if we have not and we have any prereleases stored up
-        # then we will go ahead and yield the prereleases.
-        if not yielded and found_prereleases:
-            for version in found_prereleases:
-                yield version
-
-
-_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
-
-
-def _version_split(version):
-    result = []
-    for item in version.split("."):
-        match = _prefix_regex.search(item)
-        if match:
-            result.extend(match.groups())
-        else:
-            result.append(item)
-    return result
-
-
-def _pad_version(left, right):
-    left_split, right_split = [], []
-
-    # Get the release segment of our versions
-    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
-    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
-
-    # Get the rest of our versions
-    left_split.append(left[len(left_split):])
-    right_split.append(left[len(right_split):])
-
-    # Insert our padding
-    left_split.insert(
-        1,
-        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
-    )
-    right_split.insert(
-        1,
-        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
-    )
-
-    return (
-        list(itertools.chain(*left_split)),
-        list(itertools.chain(*right_split)),
-    )
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
index df383d8b..b86bba00 100644
--- a/setuptools/_vendor/vendored.txt
+++ b/setuptools/_vendor/vendored.txt
@@ -1 +1 @@
-packaging==14.2
+packaging==14.3
-- 
cgit v1.2.1


From 4ae526d52609fe2a7515d87e4c0d047a826411a7 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Wed, 19 Nov 2014 13:38:16 -0500
Subject: Always use the vendored copy of packaging

---
 setuptools/tests/test_resources.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 8336a85d..a8520e12 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -8,12 +8,9 @@ import tempfile
 import shutil
 from unittest import TestCase
 
-try:
-    import packaging.version
-except ImportError:
-    # fallback to vendored version
-    import setuptools._vendor.packaging.version
-    packaging = setuptools._vendor.packaging
+import setuptools._vendor.packaging.version
+import setuptools._vendor.packaging.specifiers
+packaging = setuptools._vendor.packaging
 
 import pkg_resources
 from pkg_resources import (parse_requirements, VersionConflict, parse_version,
-- 
cgit v1.2.1


From 6f74eb003ba0df2049a92c60e2ebd6eaa4aba030 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Wed, 19 Nov 2014 13:38:32 -0500
Subject: Fix the use of pacakging.version.Specifier

---
 setuptools/tests/test_resources.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index a8520e12..356e1ed4 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -342,7 +342,7 @@ class RequirementsTests(TestCase):
         self.assertEqual(r2.extras, ("bar","foo"))  # extras are normalized
         self.assertEqual(hash(r1), hash(r2))
         self.assertEqual(
-            hash(r1), hash(("twisted", packaging.version.Specifier(">=1.2"),
+            hash(r1), hash(("twisted", packaging.specifiers.SpecifierSet(">=1.2"),
                             frozenset(["foo","bar"])))
         )
 
-- 
cgit v1.2.1


From b3203c3fd58476f0bead1436bf83ef05d3288d26 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 10:47:06 -0500
Subject: Bumped to 8.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 4ca9d5df..ab31fdd3 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0'
+__version__ = '8.1'
-- 
cgit v1.2.1


From 9a010cff9c654b4224721111eed0a27bb5ce726a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 14:59:23 -0500
Subject: Edit docstring for imperative form

---
 setuptools/command/egg_info.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 302d6874..cbc30ff8 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -330,12 +330,13 @@ class manifest_maker(sdist):
         self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
 
     def _add_egg_info(self, cmd):
-        """Add paths for egg-info files for an external egg-base.
+        """
+        Add paths for egg-info files for an external egg-base.
 
-        The egg-info files are written to egg-base.  If egg-base is
-        outside the current working directory, we need a separate step
-        (this method) to search the egg-base directory when creating
-        the manifest.  We use distutils.filelist.findall (which is
+        The egg-info files are written to egg-base. If egg-base is
+        outside the current working directory, this method
+        searchs the egg-base directory for files to include
+        in the manifest. Uses distutils.filelist.findall (which is
         really the version monkeypatched in by setuptools/__init__.py)
         to perform the search.
 
-- 
cgit v1.2.1


From 3ad4ef1f994dcacc32b1a5f77d4c119ec0ce75af Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 15:00:07 -0500
Subject: Remove superfluous list construction.

---
 setuptools/command/egg_info.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index cbc30ff8..e7e4cd7e 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -345,9 +345,9 @@ class manifest_maker(sdist):
         (which is looking for the absolute cmd.egg_info) will match
         them.
         """
-        self.filelist.allfiles.extend([
+        self.filelist.allfiles.extend(
             os.path.join(cmd.egg_base, path)
-            for path in distutils.filelist.findall(cmd.egg_base)])
+            for path in distutils.filelist.findall(cmd.egg_base))
 
     def prune_file_list(self):
         build = self.get_finalized_command('build')
-- 
cgit v1.2.1


From fec71bcbc8b0aa6bde0b0d054587bcd9c08019e9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 15:03:48 -0500
Subject: Extract variables to capture substeps.

---
 setuptools/command/egg_info.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index e7e4cd7e..782b2777 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -345,9 +345,9 @@ class manifest_maker(sdist):
         (which is looking for the absolute cmd.egg_info) will match
         them.
         """
-        self.filelist.allfiles.extend(
-            os.path.join(cmd.egg_base, path)
-            for path in distutils.filelist.findall(cmd.egg_base))
+        discovered = distutils.filelist.findall(cmd.egg_base)
+        resolved = (os.path.join(cmd.egg_base, path) for path in discovered)
+        self.filelist.allfiles.extend(resolved)
 
     def prune_file_list(self):
         build = self.get_finalized_command('build')
-- 
cgit v1.2.1


From e0bd38e357b89880dde1340a4089aacc1af4a89b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 15:07:15 -0500
Subject: Move invocation bypass into function itself, pertinent to the
 docstring.

---
 setuptools/command/egg_info.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 782b2777..e1324127 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -325,8 +325,7 @@ class manifest_maker(sdist):
         elif os.path.exists(self.manifest):
             self.read_manifest()
         ei_cmd = self.get_finalized_command('egg_info')
-        if ei_cmd.egg_base != os.curdir:
-            self._add_egg_info(cmd=ei_cmd)
+        self._add_egg_info(cmd=ei_cmd)
         self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
 
     def _add_egg_info(self, cmd):
@@ -345,6 +344,10 @@ class manifest_maker(sdist):
         (which is looking for the absolute cmd.egg_info) will match
         them.
         """
+        if cmd.egg_base == os.curdir:
+            # egg-info files were already added by something else
+            return
+
         discovered = distutils.filelist.findall(cmd.egg_base)
         resolved = (os.path.join(cmd.egg_base, path) for path in discovered)
         self.filelist.allfiles.extend(resolved)
-- 
cgit v1.2.1


From 1b5e1d478005b8d9d2838252e73f4c1f1e8b34da Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 15:46:58 -0500
Subject: Use os.pathsep. Fixes failure on Windows

---
 setuptools/tests/test_egg_info.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 9f813560..e8068420 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -118,7 +118,7 @@ class TestEggInfo(unittest.TestCase):
                     '--install-lib', paths['lib'],
                     '--install-scripts', paths['scripts'],
                     '--install-data', paths['data']],
-                pypath=':'.join([paths['lib'], self.old_cwd]),
+                pypath=os.pathsep.join([paths['lib'], self.old_cwd]),
                 data_stream=1,
                 env=environ)
             if code:
-- 
cgit v1.2.1


From 18fc31b1516b4493ff1925497d4a6b8bd0110809 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Sat, 13 Dec 2014 18:36:50 -0500
Subject: Restore iterating over Version objects for compat with buildout

---
 setuptools/tests/test_resources.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 356e1ed4..23872e5d 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -488,6 +488,25 @@ class ParseTests(TestCase):
             for v2 in torture[p+1:]:
                 c(v2,v1)
 
+    def testVersionBuildout(self):
+        """
+        Buildout has a function in it's bootstrap.py that inspected the return
+        value of parse_version. The new parse_version returns a Version class
+        which needs to support this behavior, at least for now.
+        """
+        def buildout(parsed_version):
+            _final_parts = '*final-', '*final'
+
+            def _final_version(parsed_version):
+                for part in parsed_version:
+                    if (part[:1] == '*') and (part not in _final_parts):
+                        return False
+                return True
+            return _final_version(parsed_version)
+
+        self.assertTrue(buildout(parse_version("1.0")))
+        self.assertFalse(buildout(parse_version("1.0a1")))
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From 7f4df756b83a337ffad17bfd51fe11e583c9e4e0 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Sat, 13 Dec 2014 18:36:50 -0500
Subject: Restore iterating over Version objects for compat with buildout

---
 setuptools/tests/test_resources.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 356e1ed4..23872e5d 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -488,6 +488,25 @@ class ParseTests(TestCase):
             for v2 in torture[p+1:]:
                 c(v2,v1)
 
+    def testVersionBuildout(self):
+        """
+        Buildout has a function in it's bootstrap.py that inspected the return
+        value of parse_version. The new parse_version returns a Version class
+        which needs to support this behavior, at least for now.
+        """
+        def buildout(parsed_version):
+            _final_parts = '*final-', '*final'
+
+            def _final_version(parsed_version):
+                for part in parsed_version:
+                    if (part[:1] == '*') and (part not in _final_parts):
+                        return False
+                return True
+            return _final_version(parsed_version)
+
+        self.assertTrue(buildout(parse_version("1.0")))
+        self.assertFalse(buildout(parse_version("1.0a1")))
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From a2340678d25e143758e12e7d92d9a77cc8daa103 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 21:42:10 -0500
Subject: Bumped to 8.0.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index ab31fdd3..49920925 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.1'
+__version__ = '8.0.1'
-- 
cgit v1.2.1


From 5bf45c863a9b88a2c62fdaaeb75538c426ab5d41 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Dec 2014 21:42:38 -0500
Subject: Bumped to 8.0.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 49920925..94d3757b 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0.1'
+__version__ = '8.0.2'
-- 
cgit v1.2.1


From 6f58c6800fcbaedd883cb56cb8197bf723f9e7ab Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Sun, 14 Dec 2014 13:22:29 -0500
Subject: Add more compatability shims to SetuptoolsVersion

* Enables indexing the SetuptoolsVersion objects, triggering the
  legacy behavior warning.
* Enables comparing the SetuptoolsVersion object to a tuple, again
  triggering the legacy behavior warning.
---
 setuptools/tests/test_resources.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 23872e5d..13f80aa4 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -507,6 +507,27 @@ class ParseTests(TestCase):
         self.assertTrue(buildout(parse_version("1.0")))
         self.assertFalse(buildout(parse_version("1.0a1")))
 
+    def testVersionIndexable(self):
+        """
+        Some projects were doing things like parse_version("v")[0], so we'll
+        support indexing the same as we support iterating.
+        """
+        self.assertEqual(parse_version("1.0")[0], "00000001")
+
+    def testVersionTupleSort(self):
+        """
+        Some projects expected to be able to sort tuples against the return
+        value of parse_version. So again we'll add a warning enabled shim to
+        make this possible.
+        """
+        self.assertTrue(parse_version("1.0") < tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("1.0") <= tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("1.0") == tuple(parse_version("1.0")))
+        self.assertTrue(parse_version("3.0") > tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("3.0") >= tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("3.0") != tuple(parse_version("2.0")))
+        self.assertFalse(parse_version("3.0") != tuple(parse_version("3.0")))
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From e27bb7d12b73046f4805025fd2a53fc6bb3b1dfa Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Sun, 14 Dec 2014 13:22:29 -0500
Subject: Add more compatability shims to SetuptoolsVersion

* Enables indexing the SetuptoolsVersion objects, triggering the
  legacy behavior warning.
* Enables comparing the SetuptoolsVersion object to a tuple, again
  triggering the legacy behavior warning.
---
 setuptools/tests/test_resources.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 23872e5d..13f80aa4 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -507,6 +507,27 @@ class ParseTests(TestCase):
         self.assertTrue(buildout(parse_version("1.0")))
         self.assertFalse(buildout(parse_version("1.0a1")))
 
+    def testVersionIndexable(self):
+        """
+        Some projects were doing things like parse_version("v")[0], so we'll
+        support indexing the same as we support iterating.
+        """
+        self.assertEqual(parse_version("1.0")[0], "00000001")
+
+    def testVersionTupleSort(self):
+        """
+        Some projects expected to be able to sort tuples against the return
+        value of parse_version. So again we'll add a warning enabled shim to
+        make this possible.
+        """
+        self.assertTrue(parse_version("1.0") < tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("1.0") <= tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("1.0") == tuple(parse_version("1.0")))
+        self.assertTrue(parse_version("3.0") > tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("3.0") >= tuple(parse_version("2.0")))
+        self.assertTrue(parse_version("3.0") != tuple(parse_version("2.0")))
+        self.assertFalse(parse_version("3.0") != tuple(parse_version("3.0")))
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From 4caa4af6ae275db9a499c27b66cc636cb9c596a1 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 14 Dec 2014 17:31:19 -0500
Subject: Bumped to 8.0.3 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 94d3757b..854fb2e8 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0.2'
+__version__ = '8.0.3'
-- 
cgit v1.2.1


From c0d31b5915055be20b8593170cddb85770b9ccc9 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Mon, 15 Dec 2014 07:41:02 -0500
Subject: Define a __hash__ on the packaging.version.Version subclasses

In Python 3.x a subclass will not inherent the __hash__ method from
the parent classes if the subclass defines a __eq__ method. This
means that without defining our own __hash__ the SetuptoolsVersion
classes are unhashable.
---
 setuptools/tests/test_resources.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 13f80aa4..1902fb2c 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -528,6 +528,16 @@ class ParseTests(TestCase):
         self.assertTrue(parse_version("3.0") != tuple(parse_version("2.0")))
         self.assertFalse(parse_version("3.0") != tuple(parse_version("3.0")))
 
+    def testVersionHashable(self):
+        """
+        Ensure that our versions stay hashable even though we've subclassed
+        them and added some shim code to them.
+        """
+        self.assertEqual(
+            hash(parse_version("1.0")),
+            hash(parse_version("1.0")),
+        )
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From 7a991fd283fdf53f7320852e5c9878db6cb84349 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Mon, 15 Dec 2014 07:41:02 -0500
Subject: Define a __hash__ on the packaging.version.Version subclasses

In Python 3.x a subclass will not inherent the __hash__ method from
the parent classes if the subclass defines a __eq__ method. This
means that without defining our own __hash__ the SetuptoolsVersion
classes are unhashable.
---
 setuptools/tests/test_resources.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 13f80aa4..1902fb2c 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -528,6 +528,16 @@ class ParseTests(TestCase):
         self.assertTrue(parse_version("3.0") != tuple(parse_version("2.0")))
         self.assertFalse(parse_version("3.0") != tuple(parse_version("3.0")))
 
+    def testVersionHashable(self):
+        """
+        Ensure that our versions stay hashable even though we've subclassed
+        them and added some shim code to them.
+        """
+        self.assertEqual(
+            hash(parse_version("1.0")),
+            hash(parse_version("1.0")),
+        )
+
 
 class ScriptHeaderTests(TestCase):
     non_ascii_exe = '/Users/José/bin/python'
-- 
cgit v1.2.1


From ee2cd1464e2073ba37be8e3003536f2602d51b13 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 15 Dec 2014 13:32:18 -0500
Subject: Bumped to 8.0.4 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 854fb2e8..09f50c23 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0.3'
+__version__ = '8.0.4'
-- 
cgit v1.2.1


From ffffc9f34b0cf5a6c67f4e10a65e034c3bf5d468 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Mon, 15 Dec 2014 15:33:01 -0500
Subject: Upgrade packaging to 14.4

This fixes an error where there is a different result for if 2.0.5
is contained within >2.0dev and >2.0.dev even though normalization
rules should have made them equal.
---
 setuptools/_vendor/packaging/__about__.py  |  2 +-
 setuptools/_vendor/packaging/specifiers.py | 10 ++++++----
 setuptools/_vendor/vendored.txt            |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py
index 481589e7..d3e3dacf 100644
--- a/setuptools/_vendor/packaging/__about__.py
+++ b/setuptools/_vendor/packaging/__about__.py
@@ -22,7 +22,7 @@ __title__ = "packaging"
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "14.3"
+__version__ = "14.4"
 
 __author__ = "Donald Stufft"
 __email__ = "donald@stufft.io"
diff --git a/setuptools/_vendor/packaging/specifiers.py b/setuptools/_vendor/packaging/specifiers.py
index bea4a398..80225786 100644
--- a/setuptools/_vendor/packaging/specifiers.py
+++ b/setuptools/_vendor/packaging/specifiers.py
@@ -461,16 +461,18 @@ class Specifier(_IndividualSpecifier):
         # Less than are defined as exclusive operators, this implies that
         # pre-releases do not match for the same series as the spec. This is
         # implemented by making V imply !=V.*.
-        return (prospective > Version(spec)
-                and self._get_operator("!=")(prospective, spec + ".*"))
+        spec = Version(spec)
+        return (prospective > spec
+                and self._get_operator("!=")(prospective, str(spec) + ".*"))
 
     def _compare_arbitrary(self, prospective, spec):
         return str(prospective).lower() == str(spec).lower()
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
index b86bba00..576aa8db 100644
--- a/setuptools/_vendor/vendored.txt
+++ b/setuptools/_vendor/vendored.txt
@@ -1 +1 @@
-packaging==14.3
+packaging==14.4
-- 
cgit v1.2.1


From f8b6c86a3121b2c2b68b2edc97b545d4567601d6 Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Mon, 15 Dec 2014 15:33:01 -0500
Subject: Upgrade packaging to 14.4

This fixes an error where there is a different result for if 2.0.5
is contained within >2.0dev and >2.0.dev even though normalization
rules should have made them equal.
---
 setuptools/_vendor/packaging/__about__.py  |  2 +-
 setuptools/_vendor/packaging/specifiers.py | 10 ++++++----
 setuptools/_vendor/vendored.txt            |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py
index 481589e7..d3e3dacf 100644
--- a/setuptools/_vendor/packaging/__about__.py
+++ b/setuptools/_vendor/packaging/__about__.py
@@ -22,7 +22,7 @@ __title__ = "packaging"
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "14.3"
+__version__ = "14.4"
 
 __author__ = "Donald Stufft"
 __email__ = "donald@stufft.io"
diff --git a/setuptools/_vendor/packaging/specifiers.py b/setuptools/_vendor/packaging/specifiers.py
index bea4a398..80225786 100644
--- a/setuptools/_vendor/packaging/specifiers.py
+++ b/setuptools/_vendor/packaging/specifiers.py
@@ -461,16 +461,18 @@ class Specifier(_IndividualSpecifier):
         # Less than are defined as exclusive operators, this implies that
         # pre-releases do not match for the same series as the spec. This is
         # implemented by making V imply !=V.*.
-        return (prospective > Version(spec)
-                and self._get_operator("!=")(prospective, spec + ".*"))
+        spec = Version(spec)
+        return (prospective > spec
+                and self._get_operator("!=")(prospective, str(spec) + ".*"))
 
     def _compare_arbitrary(self, prospective, spec):
         return str(prospective).lower() == str(spec).lower()
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
index b86bba00..576aa8db 100644
--- a/setuptools/_vendor/vendored.txt
+++ b/setuptools/_vendor/vendored.txt
@@ -1 +1 @@
-packaging==14.3
+packaging==14.4
-- 
cgit v1.2.1


From 4b4d420dac162a07f0ae57d88d563e4e41b290ad Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 15 Dec 2014 15:43:52 -0500
Subject: Bumped to 8.0.5 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 09f50c23..d9d36010 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0.4'
+__version__ = '8.0.5'
-- 
cgit v1.2.1


From ae712b5b623c9541f09816d8926f474d503fec2d Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Wed, 17 Dec 2014 21:37:45 -0500
Subject: Upgrade packaging to 14.5

* Normalizes release candidates to 1.0rc1 instead of 1.0c1
---
 setuptools/_vendor/packaging/__about__.py |  2 +-
 setuptools/_vendor/packaging/version.py   | 74 +++++++++++++++----------------
 setuptools/_vendor/vendored.txt           |  2 +-
 3 files changed, 39 insertions(+), 39 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py
index d3e3dacf..d3e50f1e 100644
--- a/setuptools/_vendor/packaging/__about__.py
+++ b/setuptools/_vendor/packaging/__about__.py
@@ -22,7 +22,7 @@ __title__ = "packaging"
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "14.4"
+__version__ = "14.5"
 
 __author__ = "Donald Stufft"
 __email__ = "donald@stufft.io"
diff --git a/setuptools/_vendor/packaging/version.py b/setuptools/_vendor/packaging/version.py
index e76e9607..8d779a48 100644
--- a/setuptools/_vendor/packaging/version.py
+++ b/setuptools/_vendor/packaging/version.py
@@ -21,7 +21,7 @@ from ._structures import Infinity
 
 
 __all__ = [
-    "parse", "Version", "LegacyVersion", "InvalidVersion",
+    "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
 ]
 
 
@@ -156,44 +156,44 @@ def _legacy_cmpkey(version):
 
     return epoch, parts
 
+# Deliberately not anchored to the start and end of the string, to make it
+# easier for 3rd party code to reuse
+VERSION_PATTERN = r"""
+    v?
+    (?:
+        (?:(?P[0-9]+)!)?                           # epoch
+        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
+        (?P
                                          # pre-release
+            [-_\.]?
+            (?P(a|b|c|rc|alpha|beta|pre|preview))
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+        (?P                                         # post release
+            (?:-(?P[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?Ppost|rev|r)
+                [-_\.]?
+                (?P[0-9]+)?
+            )
+        )?
+        (?P                                          # dev release
+            [-_\.]?
+            (?Pdev)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+    )
+    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+"""
+
 
 class Version(_BaseVersion):
 
     _regex = re.compile(
-        r"""
-        ^
-        \s*
-        v?
-        (?:
-            (?:(?P[0-9]+)!)?                           # epoch
-            (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
-            (?P
                                          # pre-release
-                [-_\.]?
-                (?P(a|b|c|rc|alpha|beta|pre|preview))
-                [-_\.]?
-                (?P[0-9]+)?
-            )?
-            (?P                                         # post release
-                (?:-(?P[0-9]+))
-                |
-                (?:
-                    [-_\.]?
-                    (?Ppost|rev|r)
-                    [-_\.]?
-                    (?P[0-9]+)?
-                )
-            )?
-            (?P                                          # dev release
-                [-_\.]?
-                (?Pdev)
-                [-_\.]?
-                (?P[0-9]+)?
-            )?
-        )
-        (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-        \s*
-        $
-        """,
+        r"^\s*" + VERSION_PATTERN + r"\s*$",
         re.VERBOSE | re.IGNORECASE,
     )
 
@@ -297,8 +297,8 @@ def _parse_letter_version(letter, number):
             letter = "a"
         elif letter == "beta":
             letter = "b"
-        elif letter in ["rc", "pre", "preview"]:
-            letter = "c"
+        elif letter in ["c", "pre", "preview"]:
+            letter = "rc"
 
         return letter, int(number)
     if not letter and number:
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
index 576aa8db..723e026b 100644
--- a/setuptools/_vendor/vendored.txt
+++ b/setuptools/_vendor/vendored.txt
@@ -1 +1 @@
-packaging==14.4
+packaging==14.5
-- 
cgit v1.2.1


From 9b3f3650b5619c89ded823dc84edb0cbad713bc6 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Dec 2014 08:39:00 -0500
Subject: Bumped to 8.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index d9d36010..ab31fdd3 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.0.5'
+__version__ = '8.1'
-- 
cgit v1.2.1


From 123ac3c8a389d3b9168abbb901c6507282b27dc2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Dec 2014 08:40:04 -0500
Subject: Bumped to 8.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index ab31fdd3..ad8076ba 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.1'
+__version__ = '8.2'
-- 
cgit v1.2.1


From 57e7ab8ebab9981efed9936ca11c939e34d52eec Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Dec 2014 09:07:53 -0500
Subject: Bumped to 8.3 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index ad8076ba..de8c596a 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.2'
+__version__ = '8.3'
-- 
cgit v1.2.1


From 5df137548ceab35e51a53f12664df130bc8f2a5f Mon Sep 17 00:00:00 2001
From: Donald Stufft 
Date: Thu, 18 Dec 2014 12:29:36 -0500
Subject: Silence PEP440Warning by default unless invoking easy_install

---
 setuptools/command/easy_install.py | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 2e00b996..a71a7f36 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -54,9 +54,14 @@ from pkg_resources import (
 import pkg_resources
 
 
+# Turn on PEP440Warnings
+warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
+
+
 sys_executable = os.environ.get('__PYVENV_LAUNCHER__',
                                 os.path.normpath(sys.executable))
 
+
 __all__ = [
     'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg',
     'main', 'get_exe_prefixes',
-- 
cgit v1.2.1


From ebb23247208e56ba422e7b80b4da813a8809ba02 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Dec 2014 20:53:46 -0500
Subject: Bumped to 8.2.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index de8c596a..7b2b8ec7 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.3'
+__version__ = '8.2.1'
-- 
cgit v1.2.1


From 42ef8cbbb3e08a89e3513bfa16b61541df1d11fa Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Dec 2014 20:54:27 -0500
Subject: Bumped to 8.2.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 7b2b8ec7..5adfd0a3 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.2.1'
+__version__ = '8.2.2'
-- 
cgit v1.2.1


From 8bedbb5ee574b2f005dd5f066638cb79dc90f0eb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 09:27:21 -0500
Subject: Use hasattr per recommendation in docs for dl.

---
 setuptools/command/build_ext.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 53bf9cd3..684200ad 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -33,10 +33,8 @@ if sys.platform == "darwin":
     use_stubs = True
 elif os.name != 'nt':
     try:
-        from dl import RTLD_NOW
-
-        have_rtld = True
-        use_stubs = True
+        import dl
+        use_stubs = have_rtld = hasattr(dl, 'RTLD_NOW')
     except ImportError:
         pass
 
-- 
cgit v1.2.1


From 3b434b5bd5a1e5e04461302850d0e2248cc828b1 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 09:59:01 -0500
Subject: Define if_dl using simple lambda.

---
 setuptools/command/build_ext.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 684200ad..b30e6192 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -39,10 +39,7 @@ elif os.name != 'nt':
         pass
 
 
-def if_dl(s):
-    if have_rtld:
-        return s
-    return ''
+if_dl = lambda s: s if have_rtld else ''
 
 
 class build_ext(_build_ext):
-- 
cgit v1.2.1


From 956dce0ba58ab95298b872155543259467054557 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:01:15 -0500
Subject: Extract variables for clarity and simpler indentation.

---
 setuptools/command/build_ext.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index b30e6192..be5e974c 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -118,10 +118,10 @@ class build_ext(_build_ext):
             # XXX what to do with conflicts?
             self.ext_map[fullname.split('.')[-1]] = ext
 
-            ltd = ext._links_to_dynamic = \
-                self.shlibs and self.links_to_dynamic(ext) or False
-            ext._needs_stub = ltd and use_stubs and not isinstance(ext,
-                                                                   Library)
+            ltd = self.shlibs and self.links_to_dynamic(ext) or False
+            ns = ltd and use_stubs and not isinstance(ext, Library)
+            ext._links_to_dynamic = ltd
+            ext._needs_stub = ns
             filename = ext._file_name = self.get_ext_filename(fullname)
             libdir = os.path.dirname(os.path.join(self.build_lib, filename))
             if ltd and libdir not in ext.library_dirs:
-- 
cgit v1.2.1


From 8f8ff1d8c42f1aeb371134abd9a96e3f876e09be Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:02:30 -0500
Subject: Extract variable for simplicity of indentation.

---
 setuptools/command/build_ext.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index be5e974c..b6eb89eb 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -181,9 +181,8 @@ class build_ext(_build_ext):
                 self.compiler = self.shlib_compiler
             _build_ext.build_extension(self, ext)
             if ext._needs_stub:
-                self.write_stub(
-                    self.get_finalized_command('build_py').build_lib, ext
-                )
+                cmd = self.get_finalized_command('build_py').build_lib
+                self.write_stub(cmd, ext)
         finally:
             self.compiler = _compiler
 
-- 
cgit v1.2.1


From d9de5582d21b62794bbdb39c0da11d711889c442 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:04:35 -0500
Subject: Rewrite short-circuit for/if/else loop as any on generator
 expression.

---
 setuptools/command/build_ext.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index b6eb89eb..dae9c81e 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -193,10 +193,7 @@ class build_ext(_build_ext):
         # XXX static-compiled version
         libnames = dict.fromkeys([lib._full_name for lib in self.shlibs])
         pkg = '.'.join(ext._full_name.split('.')[:-1] + [''])
-        for libname in ext.libraries:
-            if pkg + libname in libnames:
-                return True
-        return False
+        return any(pkg + libname in libnames for libname in ext.libraries)
 
     def get_outputs(self):
         outputs = _build_ext.get_outputs(self)
-- 
cgit v1.2.1


From 7fe63f7e3e848af843baa909930c1a61dcc2fbdd Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:06:35 -0500
Subject: Extract filtering of extensions that need stubs.

---
 setuptools/command/build_ext.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index dae9c81e..5327a030 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -198,8 +198,8 @@ class build_ext(_build_ext):
     def get_outputs(self):
         outputs = _build_ext.get_outputs(self)
         optimize = self.get_finalized_command('build_py').optimize
-        for ext in self.extensions:
-            if ext._needs_stub:
+        ns_ext = (ext for ext in self.extensions if ext._needs_stub)
+        for ext in ns_ext:
                 base = os.path.join(self.build_lib, *ext._full_name.split('.'))
                 outputs.append(base + '.py')
                 outputs.append(base + '.pyc')
-- 
cgit v1.2.1


From 0b538cb95cbaf496897fcffb3c67a217d56f2511 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:06:44 -0500
Subject: Reindent

---
 setuptools/command/build_ext.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 5327a030..414ad166 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -200,11 +200,11 @@ class build_ext(_build_ext):
         optimize = self.get_finalized_command('build_py').optimize
         ns_ext = (ext for ext in self.extensions if ext._needs_stub)
         for ext in ns_ext:
-                base = os.path.join(self.build_lib, *ext._full_name.split('.'))
-                outputs.append(base + '.py')
-                outputs.append(base + '.pyc')
-                if optimize:
-                    outputs.append(base + '.pyo')
+            base = os.path.join(self.build_lib, *ext._full_name.split('.'))
+            outputs.append(base + '.py')
+            outputs.append(base + '.pyc')
+            if optimize:
+                outputs.append(base + '.pyo')
         return outputs
 
     def write_stub(self, output_dir, ext, compile=False):
-- 
cgit v1.2.1


From 2050af11f662a28f9c2c834552c195d90a5ac73e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:11:47 -0500
Subject: Rewrite function to use extend and a generator expression.

---
 setuptools/command/build_ext.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 414ad166..b5c2738c 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -197,14 +197,13 @@ class build_ext(_build_ext):
 
     def get_outputs(self):
         outputs = _build_ext.get_outputs(self)
-        optimize = self.get_finalized_command('build_py').optimize
+        fn_exts = ['.py', '.pyc']
+        if self.get_finalized_command('build_py').optimize:
+            fn_exts.append('.pyo')
         ns_ext = (ext for ext in self.extensions if ext._needs_stub)
         for ext in ns_ext:
             base = os.path.join(self.build_lib, *ext._full_name.split('.'))
-            outputs.append(base + '.py')
-            outputs.append(base + '.pyc')
-            if optimize:
-                outputs.append(base + '.pyo')
+            outputs.extend(base + fnext for fnext in fn_exts)
         return outputs
 
     def write_stub(self, output_dir, ext, compile=False):
-- 
cgit v1.2.1


From b19c06058c720418db8a4496410cb82cc3526d54 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:16:45 -0500
Subject: Extract method for clarity.

---
 setuptools/command/build_ext.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index b5c2738c..c85351b4 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -196,7 +196,10 @@ class build_ext(_build_ext):
         return any(pkg + libname in libnames for libname in ext.libraries)
 
     def get_outputs(self):
-        outputs = _build_ext.get_outputs(self)
+        return _build_ext.get_outputs(self) + self.__get_stubs_outputs()
+
+    def __get_stubs_outputs(self):
+        outputs = []
         fn_exts = ['.py', '.pyc']
         if self.get_finalized_command('build_py').optimize:
             fn_exts.append('.pyo')
-- 
cgit v1.2.1


From 2b880cc89d0ce6845c4bdd072ac518a7ed9baa08 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:20:49 -0500
Subject: Use itertools.product to pair each base with each extension.

---
 setuptools/command/build_ext.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index c85351b4..2651beae 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -6,6 +6,7 @@ from distutils.errors import DistutilsError
 from distutils import log
 import os
 import sys
+import itertools
 
 from setuptools.extension import Library
 
@@ -199,15 +200,16 @@ class build_ext(_build_ext):
         return _build_ext.get_outputs(self) + self.__get_stubs_outputs()
 
     def __get_stubs_outputs(self):
-        outputs = []
         fn_exts = ['.py', '.pyc']
         if self.get_finalized_command('build_py').optimize:
             fn_exts.append('.pyo')
         ns_ext = (ext for ext in self.extensions if ext._needs_stub)
-        for ext in ns_ext:
-            base = os.path.join(self.build_lib, *ext._full_name.split('.'))
-            outputs.extend(base + fnext for fnext in fn_exts)
-        return outputs
+        ns_ext_bases = (
+            os.path.join(self.build_lib, *ext._full_name.split('.'))
+            for ext in ns_ext
+        )
+        pairs = itertools.product(ns_ext_bases, fn_exts)
+        return (base + fnext for base, fnext in pairs)
 
     def write_stub(self, output_dir, ext, compile=False):
         log.info("writing stub loader for %s to %s", ext._full_name,
-- 
cgit v1.2.1


From 3ade3c11402c161a623e54502472fdd6cc7bd0dc Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:21:19 -0500
Subject: Collapse two generator expressions.

---
 setuptools/command/build_ext.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 2651beae..78155223 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -203,10 +203,10 @@ class build_ext(_build_ext):
         fn_exts = ['.py', '.pyc']
         if self.get_finalized_command('build_py').optimize:
             fn_exts.append('.pyo')
-        ns_ext = (ext for ext in self.extensions if ext._needs_stub)
         ns_ext_bases = (
             os.path.join(self.build_lib, *ext._full_name.split('.'))
-            for ext in ns_ext
+            for ext in self.extensions
+            if ext._needs_stub
         )
         pairs = itertools.product(ns_ext_bases, fn_exts)
         return (base + fnext for base, fnext in pairs)
-- 
cgit v1.2.1


From df765dcb6204366f4662004217997af35590fb9b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:24:46 -0500
Subject: Extract logic for getting the extensions for outputs.

---
 setuptools/command/build_ext.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 78155223..2df3bc70 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -200,17 +200,20 @@ class build_ext(_build_ext):
         return _build_ext.get_outputs(self) + self.__get_stubs_outputs()
 
     def __get_stubs_outputs(self):
-        fn_exts = ['.py', '.pyc']
-        if self.get_finalized_command('build_py').optimize:
-            fn_exts.append('.pyo')
         ns_ext_bases = (
             os.path.join(self.build_lib, *ext._full_name.split('.'))
             for ext in self.extensions
             if ext._needs_stub
         )
-        pairs = itertools.product(ns_ext_bases, fn_exts)
+        pairs = itertools.product(ns_ext_bases, self.__get_output_extensions())
         return (base + fnext for base, fnext in pairs)
 
+    def __get_output_extensions(self):
+        yield '.py'
+        yield '.pyc'
+        if self.get_finalized_command('build_py').optimize:
+            yield '.pyo'
+
     def write_stub(self, output_dir, ext, compile=False):
         log.info("writing stub loader for %s to %s", ext._full_name,
                  output_dir)
-- 
cgit v1.2.1


From 82390398562436f2928083066d8b1d2e786643fc Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:28:35 -0500
Subject: Add comments for clarity.

---
 setuptools/command/build_ext.py | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 2df3bc70..f0913115 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -200,11 +200,13 @@ class build_ext(_build_ext):
         return _build_ext.get_outputs(self) + self.__get_stubs_outputs()
 
     def __get_stubs_outputs(self):
+        # assemble the base name for each extension that needs a stub
         ns_ext_bases = (
             os.path.join(self.build_lib, *ext._full_name.split('.'))
             for ext in self.extensions
             if ext._needs_stub
         )
+        # pair each base with the extension
         pairs = itertools.product(ns_ext_bases, self.__get_output_extensions())
         return (base + fnext for base, fnext in pairs)
 
-- 
cgit v1.2.1


From 7bcbb5cbc893e97109c15cba3ea561aa0d462148 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 23 Dec 2014 10:29:02 -0500
Subject: Force list type for easy concatenation.

---
 setuptools/command/build_ext.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index f0913115..e4b2c593 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -208,7 +208,7 @@ class build_ext(_build_ext):
         )
         # pair each base with the extension
         pairs = itertools.product(ns_ext_bases, self.__get_output_extensions())
-        return (base + fnext for base, fnext in pairs)
+        return list(base + fnext for base, fnext in pairs)
 
     def __get_output_extensions(self):
         yield '.py'
-- 
cgit v1.2.1


From 9063c163e105545bacb67865f5d35056eb342a49 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Dec 2014 17:02:04 -0500
Subject: Move vendored packaging module into pkg_resources._vendor, restoring
 independence of pkg_resources from setuptools. Fixes #311.

---
 setuptools/_vendor/__init__.py              |   0
 setuptools/_vendor/packaging/__about__.py   |  31 --
 setuptools/_vendor/packaging/__init__.py    |  24 -
 setuptools/_vendor/packaging/_compat.py     |  40 --
 setuptools/_vendor/packaging/_structures.py |  78 ---
 setuptools/_vendor/packaging/specifiers.py  | 734 ----------------------------
 setuptools/_vendor/packaging/version.py     | 376 --------------
 setuptools/_vendor/vendored.txt             |   1 -
 setuptools/command/egg_info.py              |   4 +-
 setuptools/dist.py                          |   4 +-
 setuptools/tests/test_resources.py          |   6 +-
 11 files changed, 7 insertions(+), 1291 deletions(-)
 delete mode 100644 setuptools/_vendor/__init__.py
 delete mode 100644 setuptools/_vendor/packaging/__about__.py
 delete mode 100644 setuptools/_vendor/packaging/__init__.py
 delete mode 100644 setuptools/_vendor/packaging/_compat.py
 delete mode 100644 setuptools/_vendor/packaging/_structures.py
 delete mode 100644 setuptools/_vendor/packaging/specifiers.py
 delete mode 100644 setuptools/_vendor/packaging/version.py
 delete mode 100644 setuptools/_vendor/vendored.txt

(limited to 'setuptools')

diff --git a/setuptools/_vendor/__init__.py b/setuptools/_vendor/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/setuptools/_vendor/packaging/__about__.py b/setuptools/_vendor/packaging/__about__.py
deleted file mode 100644
index d3e50f1e..00000000
--- a/setuptools/_vendor/packaging/__about__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-__all__ = [
-    "__title__", "__summary__", "__uri__", "__version__", "__author__",
-    "__email__", "__license__", "__copyright__",
-]
-
-__title__ = "packaging"
-__summary__ = "Core utilities for Python packages"
-__uri__ = "https://github.com/pypa/packaging"
-
-__version__ = "14.5"
-
-__author__ = "Donald Stufft"
-__email__ = "donald@stufft.io"
-
-__license__ = "Apache License, Version 2.0"
-__copyright__ = "Copyright 2014 %s" % __author__
diff --git a/setuptools/_vendor/packaging/__init__.py b/setuptools/_vendor/packaging/__init__.py
deleted file mode 100644
index c39a8eab..00000000
--- a/setuptools/_vendor/packaging/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-from .__about__ import (
-    __author__, __copyright__, __email__, __license__, __summary__, __title__,
-    __uri__, __version__
-)
-
-__all__ = [
-    "__title__", "__summary__", "__uri__", "__version__", "__author__",
-    "__email__", "__license__", "__copyright__",
-]
diff --git a/setuptools/_vendor/packaging/_compat.py b/setuptools/_vendor/packaging/_compat.py
deleted file mode 100644
index 5c396cea..00000000
--- a/setuptools/_vendor/packaging/_compat.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-import sys
-
-
-PY2 = sys.version_info[0] == 2
-PY3 = sys.version_info[0] == 3
-
-# flake8: noqa
-
-if PY3:
-    string_types = str,
-else:
-    string_types = basestring,
-
-
-def with_metaclass(meta, *bases):
-    """
-    Create a base class with a metaclass.
-    """
-    # This requires a bit of explanation: the basic idea is to make a dummy
-    # metaclass for one level of class instantiation that replaces itself with
-    # the actual metaclass.
-    class metaclass(meta):
-        def __new__(cls, name, this_bases, d):
-            return meta(name, bases, d)
-    return type.__new__(metaclass, 'temporary_class', (), {})
diff --git a/setuptools/_vendor/packaging/_structures.py b/setuptools/_vendor/packaging/_structures.py
deleted file mode 100644
index 0ae9bb52..00000000
--- a/setuptools/_vendor/packaging/_structures.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-
-class Infinity(object):
-
-    def __repr__(self):
-        return "Infinity"
-
-    def __hash__(self):
-        return hash(repr(self))
-
-    def __lt__(self, other):
-        return False
-
-    def __le__(self, other):
-        return False
-
-    def __eq__(self, other):
-        return isinstance(other, self.__class__)
-
-    def __ne__(self, other):
-        return not isinstance(other, self.__class__)
-
-    def __gt__(self, other):
-        return True
-
-    def __ge__(self, other):
-        return True
-
-    def __neg__(self):
-        return NegativeInfinity
-
-Infinity = Infinity()
-
-
-class NegativeInfinity(object):
-
-    def __repr__(self):
-        return "-Infinity"
-
-    def __hash__(self):
-        return hash(repr(self))
-
-    def __lt__(self, other):
-        return True
-
-    def __le__(self, other):
-        return True
-
-    def __eq__(self, other):
-        return isinstance(other, self.__class__)
-
-    def __ne__(self, other):
-        return not isinstance(other, self.__class__)
-
-    def __gt__(self, other):
-        return False
-
-    def __ge__(self, other):
-        return False
-
-    def __neg__(self):
-        return Infinity
-
-NegativeInfinity = NegativeInfinity()
diff --git a/setuptools/_vendor/packaging/specifiers.py b/setuptools/_vendor/packaging/specifiers.py
deleted file mode 100644
index 80225786..00000000
--- a/setuptools/_vendor/packaging/specifiers.py
+++ /dev/null
@@ -1,734 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-import abc
-import functools
-import itertools
-import re
-
-from ._compat import string_types, with_metaclass
-from .version import Version, LegacyVersion, parse
-
-
-class InvalidSpecifier(ValueError):
-    """
-    An invalid specifier was found, users should refer to PEP 440.
-    """
-
-
-class BaseSpecifier(with_metaclass(abc.ABCMeta, object)):
-
-    @abc.abstractmethod
-    def __str__(self):
-        """
-        Returns the str representation of this Specifier like object. This
-        should be representative of the Specifier itself.
-        """
-
-    @abc.abstractmethod
-    def __hash__(self):
-        """
-        Returns a hash value for this Specifier like object.
-        """
-
-    @abc.abstractmethod
-    def __eq__(self, other):
-        """
-        Returns a boolean representing whether or not the two Specifier like
-        objects are equal.
-        """
-
-    @abc.abstractmethod
-    def __ne__(self, other):
-        """
-        Returns a boolean representing whether or not the two Specifier like
-        objects are not equal.
-        """
-
-    @abc.abstractproperty
-    def prereleases(self):
-        """
-        Returns whether or not pre-releases as a whole are allowed by this
-        specifier.
-        """
-
-    @prereleases.setter
-    def prereleases(self, value):
-        """
-        Sets whether or not pre-releases as a whole are allowed by this
-        specifier.
-        """
-
-    @abc.abstractmethod
-    def contains(self, item, prereleases=None):
-        """
-        Determines if the given item is contained within this specifier.
-        """
-
-    @abc.abstractmethod
-    def filter(self, iterable, prereleases=None):
-        """
-        Takes an iterable of items and filters them so that only items which
-        are contained within this specifier are allowed in it.
-        """
-
-
-class _IndividualSpecifier(BaseSpecifier):
-
-    _operators = {}
-
-    def __init__(self, spec="", prereleases=None):
-        match = self._regex.search(spec)
-        if not match:
-            raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
-
-        self._spec = (
-            match.group("operator").strip(),
-            match.group("version").strip(),
-        )
-
-        # Store whether or not this Specifier should accept prereleases
-        self._prereleases = prereleases
-
-    def __repr__(self):
-        pre = (
-            ", prereleases={0!r}".format(self.prereleases)
-            if self._prereleases is not None
-            else ""
-        )
-
-        return "<{0}({1!r}{2})>".format(
-            self.__class__.__name__,
-            str(self),
-            pre,
-        )
-
-    def __str__(self):
-        return "{0}{1}".format(*self._spec)
-
-    def __hash__(self):
-        return hash(self._spec)
-
-    def __eq__(self, other):
-        if isinstance(other, string_types):
-            try:
-                other = self.__class__(other)
-            except InvalidSpecifier:
-                return NotImplemented
-        elif not isinstance(other, self.__class__):
-            return NotImplemented
-
-        return self._spec == other._spec
-
-    def __ne__(self, other):
-        if isinstance(other, string_types):
-            try:
-                other = self.__class__(other)
-            except InvalidSpecifier:
-                return NotImplemented
-        elif not isinstance(other, self.__class__):
-            return NotImplemented
-
-        return self._spec != other._spec
-
-    def _get_operator(self, op):
-        return getattr(self, "_compare_{0}".format(self._operators[op]))
-
-    def _coerce_version(self, version):
-        if not isinstance(version, (LegacyVersion, Version)):
-            version = parse(version)
-        return version
-
-    @property
-    def prereleases(self):
-        return self._prereleases
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-    def contains(self, item, prereleases=None):
-        # Determine if prereleases are to be allowed or not.
-        if prereleases is None:
-            prereleases = self.prereleases
-
-        # Normalize item to a Version or LegacyVersion, this allows us to have
-        # a shortcut for ``"2.0" in Specifier(">=2")
-        item = self._coerce_version(item)
-
-        # Determine if we should be supporting prereleases in this specifier
-        # or not, if we do not support prereleases than we can short circuit
-        # logic if this version is a prereleases.
-        if item.is_prerelease and not prereleases:
-            return False
-
-        # Actually do the comparison to determine if this item is contained
-        # within this Specifier or not.
-        return self._get_operator(self._spec[0])(item, self._spec[1])
-
-    def filter(self, iterable, prereleases=None):
-        yielded = False
-        found_prereleases = []
-
-        kw = {"prereleases": prereleases if prereleases is not None else True}
-
-        # Attempt to iterate over all the values in the iterable and if any of
-        # them match, yield them.
-        for version in iterable:
-            parsed_version = self._coerce_version(version)
-
-            if self.contains(parsed_version, **kw):
-                # If our version is a prerelease, and we were not set to allow
-                # prereleases, then we'll store it for later incase nothing
-                # else matches this specifier.
-                if (parsed_version.is_prerelease
-                        and not (prereleases or self.prereleases)):
-                    found_prereleases.append(version)
-                # Either this is not a prerelease, or we should have been
-                # accepting prereleases from the begining.
-                else:
-                    yielded = True
-                    yield version
-
-        # Now that we've iterated over everything, determine if we've yielded
-        # any values, and if we have not and we have any prereleases stored up
-        # then we will go ahead and yield the prereleases.
-        if not yielded and found_prereleases:
-            for version in found_prereleases:
-                yield version
-
-
-class LegacySpecifier(_IndividualSpecifier):
-
-    _regex = re.compile(
-        r"""
-        ^
-        \s*
-        (?P(==|!=|<=|>=|<|>))
-        \s*
-        (?P
-            [^\s]* # We just match everything, except for whitespace since this
-                   # is a "legacy" specifier and the version string can be just
-                   # about anything.
-        )
-        \s*
-        $
-        """,
-        re.VERBOSE | re.IGNORECASE,
-    )
-
-    _operators = {
-        "==": "equal",
-        "!=": "not_equal",
-        "<=": "less_than_equal",
-        ">=": "greater_than_equal",
-        "<": "less_than",
-        ">": "greater_than",
-    }
-
-    def _coerce_version(self, version):
-        if not isinstance(version, LegacyVersion):
-            version = LegacyVersion(str(version))
-        return version
-
-    def _compare_equal(self, prospective, spec):
-        return prospective == self._coerce_version(spec)
-
-    def _compare_not_equal(self, prospective, spec):
-        return prospective != self._coerce_version(spec)
-
-    def _compare_less_than_equal(self, prospective, spec):
-        return prospective <= self._coerce_version(spec)
-
-    def _compare_greater_than_equal(self, prospective, spec):
-        return prospective >= self._coerce_version(spec)
-
-    def _compare_less_than(self, prospective, spec):
-        return prospective < self._coerce_version(spec)
-
-    def _compare_greater_than(self, prospective, spec):
-        return prospective > self._coerce_version(spec)
-
-
-def _require_version_compare(fn):
-    @functools.wraps(fn)
-    def wrapped(self, prospective, spec):
-        if not isinstance(prospective, Version):
-            return False
-        return fn(self, prospective, spec)
-    return wrapped
-
-
-class Specifier(_IndividualSpecifier):
-
-    _regex = re.compile(
-        r"""
-        ^
-        \s*
-        (?P(~=|==|!=|<=|>=|<|>|===))
-        (?P
-            (?:
-                # The identity operators allow for an escape hatch that will
-                # do an exact string match of the version you wish to install.
-                # This will not be parsed by PEP 440 and we cannot determine
-                # any semantic meaning from it. This operator is discouraged
-                # but included entirely as an escape hatch.
-                (?<====)  # Only match for the identity operator
-                \s*
-                [^\s]*    # We just match everything, except for whitespace
-                          # since we are only testing for strict identity.
-            )
-            |
-            (?:
-                # The (non)equality operators allow for wild card and local
-                # versions to be specified so we have to define these two
-                # operators separately to enable that.
-                (?<===|!=)            # Only match for equals and not equals
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)*   # release
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-
-                # You cannot use a wild card and a dev or local version
-                # together so group them with a | and make them optional.
-                (?:
-                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
-                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
-                    |
-                    \.\*  # Wild card syntax of .*
-                )?
-            )
-            |
-            (?:
-                # The compatible operator requires at least two digits in the
-                # release segment.
-                (?<=~=)               # Only match for the compatible operator
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
-            )
-            |
-            (?:
-                # All other operators only allow a sub set of what the
-                # (non)equality operators do. Specifically they do not allow
-                # local versions to be specified nor do they allow the prefix
-                # matching wild cards.
-                (?=": "greater_than_equal",
-        "<": "less_than",
-        ">": "greater_than",
-        "===": "arbitrary",
-    }
-
-    @_require_version_compare
-    def _compare_compatible(self, prospective, spec):
-        # Compatible releases have an equivalent combination of >= and ==. That
-        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
-        # implement this in terms of the other specifiers instead of
-        # implementing it ourselves. The only thing we need to do is construct
-        # the other specifiers.
-
-        # We want everything but the last item in the version, but we want to
-        # ignore post and dev releases and we want to treat the pre-release as
-        # it's own separate segment.
-        prefix = ".".join(
-            list(
-                itertools.takewhile(
-                    lambda x: (not x.startswith("post")
-                               and not x.startswith("dev")),
-                    _version_split(spec),
-                )
-            )[:-1]
-        )
-
-        # Add the prefix notation to the end of our string
-        prefix += ".*"
-
-        return (self._get_operator(">=")(prospective, spec)
-                and self._get_operator("==")(prospective, prefix))
-
-    @_require_version_compare
-    def _compare_equal(self, prospective, spec):
-        # We need special logic to handle prefix matching
-        if spec.endswith(".*"):
-            # Split the spec out by dots, and pretend that there is an implicit
-            # dot in between a release segment and a pre-release segment.
-            spec = _version_split(spec[:-2])  # Remove the trailing .*
-
-            # Split the prospective version out by dots, and pretend that there
-            # is an implicit dot in between a release segment and a pre-release
-            # segment.
-            prospective = _version_split(str(prospective))
-
-            # Shorten the prospective version to be the same length as the spec
-            # so that we can determine if the specifier is a prefix of the
-            # prospective version or not.
-            prospective = prospective[:len(spec)]
-
-            # Pad out our two sides with zeros so that they both equal the same
-            # length.
-            spec, prospective = _pad_version(spec, prospective)
-        else:
-            # Convert our spec string into a Version
-            spec = Version(spec)
-
-            # If the specifier does not have a local segment, then we want to
-            # act as if the prospective version also does not have a local
-            # segment.
-            if not spec.local:
-                prospective = Version(prospective.public)
-
-        return prospective == spec
-
-    @_require_version_compare
-    def _compare_not_equal(self, prospective, spec):
-        return not self._compare_equal(prospective, spec)
-
-    @_require_version_compare
-    def _compare_less_than_equal(self, prospective, spec):
-        return prospective <= Version(spec)
-
-    @_require_version_compare
-    def _compare_greater_than_equal(self, prospective, spec):
-        return prospective >= Version(spec)
-
-    @_require_version_compare
-    def _compare_less_than(self, prospective, spec):
-        # Less than are defined as exclusive operators, this implies that
-        # pre-releases do not match for the same series as the spec. This is
-        # implemented by making V imply !=V.*.
-        spec = Version(spec)
-        return (prospective > spec
-                and self._get_operator("!=")(prospective, str(spec) + ".*"))
-
-    def _compare_arbitrary(self, prospective, spec):
-        return str(prospective).lower() == str(spec).lower()
-
-    @property
-    def prereleases(self):
-        # If there is an explicit prereleases set for this, then we'll just
-        # blindly use that.
-        if self._prereleases is not None:
-            return self._prereleases
-
-        # Look at all of our specifiers and determine if they are inclusive
-        # operators, and if they are if they are including an explicit
-        # prerelease.
-        operator, version = self._spec
-        if operator in ["==", ">=", "<=", "~="]:
-            # The == specifier can include a trailing .*, if it does we
-            # want to remove before parsing.
-            if operator == "==" and version.endswith(".*"):
-                version = version[:-2]
-
-            # Parse the version, and if it is a pre-release than this
-            # specifier allows pre-releases.
-            if parse(version).is_prerelease:
-                return True
-
-        return False
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-
-_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
-
-
-def _version_split(version):
-    result = []
-    for item in version.split("."):
-        match = _prefix_regex.search(item)
-        if match:
-            result.extend(match.groups())
-        else:
-            result.append(item)
-    return result
-
-
-def _pad_version(left, right):
-    left_split, right_split = [], []
-
-    # Get the release segment of our versions
-    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
-    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
-
-    # Get the rest of our versions
-    left_split.append(left[len(left_split):])
-    right_split.append(left[len(right_split):])
-
-    # Insert our padding
-    left_split.insert(
-        1,
-        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
-    )
-    right_split.insert(
-        1,
-        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
-    )
-
-    return (
-        list(itertools.chain(*left_split)),
-        list(itertools.chain(*right_split)),
-    )
-
-
-class SpecifierSet(BaseSpecifier):
-
-    def __init__(self, specifiers="", prereleases=None):
-        # Split on , to break each indidivual specifier into it's own item, and
-        # strip each item to remove leading/trailing whitespace.
-        specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
-
-        # Parsed each individual specifier, attempting first to make it a
-        # Specifier and falling back to a LegacySpecifier.
-        parsed = set()
-        for specifier in specifiers:
-            try:
-                parsed.add(Specifier(specifier))
-            except InvalidSpecifier:
-                parsed.add(LegacySpecifier(specifier))
-
-        # Turn our parsed specifiers into a frozen set and save them for later.
-        self._specs = frozenset(parsed)
-
-        # Store our prereleases value so we can use it later to determine if
-        # we accept prereleases or not.
-        self._prereleases = prereleases
-
-    def __repr__(self):
-        pre = (
-            ", prereleases={0!r}".format(self.prereleases)
-            if self._prereleases is not None
-            else ""
-        )
-
-        return "".format(str(self), pre)
-
-    def __str__(self):
-        return ",".join(sorted(str(s) for s in self._specs))
-
-    def __hash__(self):
-        return hash(self._specs)
-
-    def __and__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        specifier = SpecifierSet()
-        specifier._specs = frozenset(self._specs | other._specs)
-
-        if self._prereleases is None and other._prereleases is not None:
-            specifier._prereleases = other._prereleases
-        elif self._prereleases is not None and other._prereleases is None:
-            specifier._prereleases = self._prereleases
-        elif self._prereleases == other._prereleases:
-            specifier._prereleases = self._prereleases
-        else:
-            raise ValueError(
-                "Cannot combine SpecifierSets with True and False prerelease "
-                "overrides."
-            )
-
-        return specifier
-
-    def __eq__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif isinstance(other, _IndividualSpecifier):
-            other = SpecifierSet(str(other))
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        return self._specs == other._specs
-
-    def __ne__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif isinstance(other, _IndividualSpecifier):
-            other = SpecifierSet(str(other))
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        return self._specs != other._specs
-
-    @property
-    def prereleases(self):
-        # If we have been given an explicit prerelease modifier, then we'll
-        # pass that through here.
-        if self._prereleases is not None:
-            return self._prereleases
-
-        # Otherwise we'll see if any of the given specifiers accept
-        # prereleases, if any of them do we'll return True, otherwise False.
-        # Note: The use of any() here means that an empty set of specifiers
-        #       will always return False, this is an explicit design decision.
-        return any(s.prereleases for s in self._specs)
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-    def contains(self, item, prereleases=None):
-        # Ensure that our item is a Version or LegacyVersion instance.
-        if not isinstance(item, (LegacyVersion, Version)):
-            item = parse(item)
-
-        # We can determine if we're going to allow pre-releases by looking to
-        # see if any of the underlying items supports them. If none of them do
-        # and this item is a pre-release then we do not allow it and we can
-        # short circuit that here.
-        # Note: This means that 1.0.dev1 would not be contained in something
-        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0
-        if (not (self.prereleases or prereleases)) and item.is_prerelease:
-            return False
-
-        # Determine if we're forcing a prerelease or not, we bypass
-        # self.prereleases here and use self._prereleases because we want to
-        # only take into consideration actual *forced* values. The underlying
-        # specifiers will handle the other logic.
-        # The logic here is: If prereleases is anything but None, we'll just
-        #                    go aheand and continue to use that. However if
-        #                    prereleases is None, then we'll use whatever the
-        #                    value of self._prereleases is as long as it is not
-        #                    None itself.
-        if prereleases is None and self._prereleases is not None:
-            prereleases = self._prereleases
-
-        # We simply dispatch to the underlying specs here to make sure that the
-        # given version is contained within all of them.
-        # Note: This use of all() here means that an empty set of specifiers
-        #       will always return True, this is an explicit design decision.
-        return all(
-            s.contains(item, prereleases=prereleases)
-            for s in self._specs
-        )
-
-    def filter(self, iterable, prereleases=None):
-        # Determine if we're forcing a prerelease or not, we bypass
-        # self.prereleases here and use self._prereleases because we want to
-        # only take into consideration actual *forced* values. The underlying
-        # specifiers will handle the other logic.
-        # The logic here is: If prereleases is anything but None, we'll just
-        #                    go aheand and continue to use that. However if
-        #                    prereleases is None, then we'll use whatever the
-        #                    value of self._prereleases is as long as it is not
-        #                    None itself.
-        if prereleases is None and self._prereleases is not None:
-            prereleases = self._prereleases
-
-        # If we have any specifiers, then we want to wrap our iterable in the
-        # filter method for each one, this will act as a logical AND amongst
-        # each specifier.
-        if self._specs:
-            for spec in self._specs:
-                iterable = spec.filter(iterable, prereleases=prereleases)
-            return iterable
-        # If we do not have any specifiers, then we need to have a rough filter
-        # which will filter out any pre-releases, unless there are no final
-        # releases, and which will filter out LegacyVersion in general.
-        else:
-            filtered = []
-            found_prereleases = []
-
-            for item in iterable:
-                # Ensure that we some kind of Version class for this item.
-                if not isinstance(item, (LegacyVersion, Version)):
-                    parsed_version = parse(item)
-                else:
-                    parsed_version = item
-
-                # Filter out any item which is parsed as a LegacyVersion
-                if isinstance(parsed_version, LegacyVersion):
-                    continue
-
-                # Store any item which is a pre-release for later unless we've
-                # already found a final version or we are accepting prereleases
-                if parsed_version.is_prerelease and not prereleases:
-                    if not filtered:
-                        found_prereleases.append(item)
-                else:
-                    filtered.append(item)
-
-            # If we've found no items except for pre-releases, then we'll go
-            # ahead and use the pre-releases
-            if not filtered and found_prereleases and prereleases is None:
-                return found_prereleases
-
-            return filtered
diff --git a/setuptools/_vendor/packaging/version.py b/setuptools/_vendor/packaging/version.py
deleted file mode 100644
index 8d779a48..00000000
--- a/setuptools/_vendor/packaging/version.py
+++ /dev/null
@@ -1,376 +0,0 @@
-# Copyright 2014 Donald Stufft
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from __future__ import absolute_import, division, print_function
-
-import collections
-import itertools
-import re
-
-from ._structures import Infinity
-
-
-__all__ = [
-    "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
-]
-
-
-_Version = collections.namedtuple(
-    "_Version",
-    ["epoch", "release", "dev", "pre", "post", "local"],
-)
-
-
-def parse(version):
-    """
-    Parse the given version string and return either a :class:`Version` object
-    or a :class:`LegacyVersion` object depending on if the given version is
-    a valid PEP 440 version or a legacy version.
-    """
-    try:
-        return Version(version)
-    except InvalidVersion:
-        return LegacyVersion(version)
-
-
-class InvalidVersion(ValueError):
-    """
-    An invalid version was found, users should refer to PEP 440.
-    """
-
-
-class _BaseVersion(object):
-
-    def __hash__(self):
-        return hash(self._key)
-
-    def __lt__(self, other):
-        return self._compare(other, lambda s, o: s < o)
-
-    def __le__(self, other):
-        return self._compare(other, lambda s, o: s <= o)
-
-    def __eq__(self, other):
-        return self._compare(other, lambda s, o: s == o)
-
-    def __ge__(self, other):
-        return self._compare(other, lambda s, o: s >= o)
-
-    def __gt__(self, other):
-        return self._compare(other, lambda s, o: s > o)
-
-    def __ne__(self, other):
-        return self._compare(other, lambda s, o: s != o)
-
-    def _compare(self, other, method):
-        if not isinstance(other, _BaseVersion):
-            return NotImplemented
-
-        return method(self._key, other._key)
-
-
-class LegacyVersion(_BaseVersion):
-
-    def __init__(self, version):
-        self._version = str(version)
-        self._key = _legacy_cmpkey(self._version)
-
-    def __str__(self):
-        return self._version
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    @property
-    def public(self):
-        return self._version
-
-    @property
-    def local(self):
-        return None
-
-    @property
-    def is_prerelease(self):
-        return False
-
-
-_legacy_version_component_re = re.compile(
-    r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
-)
-
-_legacy_version_replacement_map = {
-    "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
-}
-
-
-def _parse_version_parts(s):
-    for part in _legacy_version_component_re.split(s):
-        part = _legacy_version_replacement_map.get(part, part)
-
-        if not part or part == ".":
-            continue
-
-        if part[:1] in "0123456789":
-            # pad for numeric comparison
-            yield part.zfill(8)
-        else:
-            yield "*" + part
-
-    # ensure that alpha/beta/candidate are before final
-    yield "*final"
-
-
-def _legacy_cmpkey(version):
-    # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
-    # greater than or equal to 0. This will effectively put the LegacyVersion,
-    # which uses the defacto standard originally implemented by setuptools,
-    # as before all PEP 440 versions.
-    epoch = -1
-
-    # This scheme is taken from pkg_resources.parse_version setuptools prior to
-    # it's adoption of the packaging library.
-    parts = []
-    for part in _parse_version_parts(version.lower()):
-        if part.startswith("*"):
-            # remove "-" before a prerelease tag
-            if part < "*final":
-                while parts and parts[-1] == "*final-":
-                    parts.pop()
-
-            # remove trailing zeros from each series of numeric parts
-            while parts and parts[-1] == "00000000":
-                parts.pop()
-
-        parts.append(part)
-    parts = tuple(parts)
-
-    return epoch, parts
-
-# Deliberately not anchored to the start and end of the string, to make it
-# easier for 3rd party code to reuse
-VERSION_PATTERN = r"""
-    v?
-    (?:
-        (?:(?P[0-9]+)!)?                           # epoch
-        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
-        (?P
                                          # pre-release
-            [-_\.]?
-            (?P(a|b|c|rc|alpha|beta|pre|preview))
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-        (?P                                         # post release
-            (?:-(?P[0-9]+))
-            |
-            (?:
-                [-_\.]?
-                (?Ppost|rev|r)
-                [-_\.]?
-                (?P[0-9]+)?
-            )
-        )?
-        (?P                                          # dev release
-            [-_\.]?
-            (?Pdev)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-    )
-    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-"""
-
-
-class Version(_BaseVersion):
-
-    _regex = re.compile(
-        r"^\s*" + VERSION_PATTERN + r"\s*$",
-        re.VERBOSE | re.IGNORECASE,
-    )
-
-    def __init__(self, version):
-        # Validate the version and parse it into pieces
-        match = self._regex.search(version)
-        if not match:
-            raise InvalidVersion("Invalid version: '{0}'".format(version))
-
-        # Store the parsed out pieces of the version
-        self._version = _Version(
-            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
-            release=tuple(int(i) for i in match.group("release").split(".")),
-            pre=_parse_letter_version(
-                match.group("pre_l"),
-                match.group("pre_n"),
-            ),
-            post=_parse_letter_version(
-                match.group("post_l"),
-                match.group("post_n1") or match.group("post_n2"),
-            ),
-            dev=_parse_letter_version(
-                match.group("dev_l"),
-                match.group("dev_n"),
-            ),
-            local=_parse_local_version(match.group("local")),
-        )
-
-        # Generate a key which will be used for sorting
-        self._key = _cmpkey(
-            self._version.epoch,
-            self._version.release,
-            self._version.pre,
-            self._version.post,
-            self._version.dev,
-            self._version.local,
-        )
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    def __str__(self):
-        parts = []
-
-        # Epoch
-        if self._version.epoch != 0:
-            parts.append("{0}!".format(self._version.epoch))
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self._version.release))
-
-        # Pre-release
-        if self._version.pre is not None:
-            parts.append("".join(str(x) for x in self._version.pre))
-
-        # Post-release
-        if self._version.post is not None:
-            parts.append(".post{0}".format(self._version.post[1]))
-
-        # Development release
-        if self._version.dev is not None:
-            parts.append(".dev{0}".format(self._version.dev[1]))
-
-        # Local version segment
-        if self._version.local is not None:
-            parts.append(
-                "+{0}".format(".".join(str(x) for x in self._version.local))
-            )
-
-        return "".join(parts)
-
-    @property
-    def public(self):
-        return str(self).split("+", 1)[0]
-
-    @property
-    def local(self):
-        version_string = str(self)
-        if "+" in version_string:
-            return version_string.split("+", 1)[1]
-
-    @property
-    def is_prerelease(self):
-        return bool(self._version.dev or self._version.pre)
-
-
-def _parse_letter_version(letter, number):
-    if letter:
-        # We consider there to be an implicit 0 in a pre-release if there is
-        # not a numeral associated with it.
-        if number is None:
-            number = 0
-
-        # We normalize any letters to their lower case form
-        letter = letter.lower()
-
-        # We consider some words to be alternate spellings of other words and
-        # in those cases we want to normalize the spellings to our preferred
-        # spelling.
-        if letter == "alpha":
-            letter = "a"
-        elif letter == "beta":
-            letter = "b"
-        elif letter in ["c", "pre", "preview"]:
-            letter = "rc"
-
-        return letter, int(number)
-    if not letter and number:
-        # We assume if we are given a number, but we are not given a letter
-        # then this is using the implicit post release syntax (e.g. 1.0-1)
-        letter = "post"
-
-        return letter, int(number)
-
-
-_local_version_seperators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local):
-    """
-    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
-    """
-    if local is not None:
-        return tuple(
-            part.lower() if not part.isdigit() else int(part)
-            for part in _local_version_seperators.split(local)
-        )
-
-
-def _cmpkey(epoch, release, pre, post, dev, local):
-    # When we compare a release version, we want to compare it with all of the
-    # trailing zeros removed. So we'll use a reverse the list, drop all the now
-    # leading zeros until we come to something non zero, then take the rest
-    # re-reverse it back into the correct order and make it a tuple and use
-    # that for our sorting key.
-    release = tuple(
-        reversed(list(
-            itertools.dropwhile(
-                lambda x: x == 0,
-                reversed(release),
-            )
-        ))
-    )
-
-    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
-    # We'll do this by abusing the pre segment, but we _only_ want to do this
-    # if there is not a pre or a post segment. If we have one of those then
-    # the normal sorting rules will handle this case correctly.
-    if pre is None and post is None and dev is not None:
-        pre = -Infinity
-    # Versions without a pre-release (except as noted above) should sort after
-    # those with one.
-    elif pre is None:
-        pre = Infinity
-
-    # Versions without a post segment should sort before those with one.
-    if post is None:
-        post = -Infinity
-
-    # Versions without a development segment should sort after those with one.
-    if dev is None:
-        dev = Infinity
-
-    if local is None:
-        # Versions without a local segment should sort before those with one.
-        local = -Infinity
-    else:
-        # Versions with a local segment need that segment parsed to implement
-        # the sorting rules in PEP440.
-        # - Alpha numeric segments sort before numeric segments
-        # - Alpha numeric segments sort lexicographically
-        # - Numeric segments sort numerically
-        # - Shorter versions sort before longer versions when the prefixes
-        #   match exactly
-        local = tuple(
-            (i, "") if isinstance(i, int) else (-Infinity, i)
-            for i in local
-        )
-
-    return epoch, release, pre, post, dev, local
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
deleted file mode 100644
index 723e026b..00000000
--- a/setuptools/_vendor/vendored.txt
+++ /dev/null
@@ -1 +0,0 @@
-packaging==14.5
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index e1324127..dfbab0e9 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -15,8 +15,8 @@ try:
     import packaging.version
 except ImportError:
     # fallback to vendored version
-    import setuptools._vendor.packaging.version
-    packaging = setuptools._vendor.packaging
+    import pkg_resources._vendor.packaging.version
+    packaging = pkg_resources._vendor.packaging
 
 from setuptools import Command
 from setuptools.command.sdist import sdist
diff --git a/setuptools/dist.py b/setuptools/dist.py
index e44796fd..2daa2835 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -17,8 +17,8 @@ try:
     import packaging.version
 except ImportError:
     # fallback to vendored version
-    import setuptools._vendor.packaging.version
-    packaging = setuptools._vendor.packaging
+    import pkg_resources._vendor.packaging.version
+    packaging = pkg_resources._vendor.packaging
 
 from setuptools.depends import Require
 from setuptools.compat import basestring, PY2
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 1902fb2c..7cf2385b 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -8,9 +8,9 @@ import tempfile
 import shutil
 from unittest import TestCase
 
-import setuptools._vendor.packaging.version
-import setuptools._vendor.packaging.specifiers
-packaging = setuptools._vendor.packaging
+import pkg_resources._vendor.packaging.version
+import pkg_resources._vendor.packaging.specifiers
+packaging = pkg_resources._vendor.packaging
 
 import pkg_resources
 from pkg_resources import (parse_requirements, VersionConflict, parse_version,
-- 
cgit v1.2.1


From 170657b68f4b92e7e1bf82f5e19a831f5744af67 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Dec 2014 17:11:49 -0500
Subject: Setuptools now uses the 'packaging' package from pkg_resources,
 unifying the behavior around resolution of that package.

---
 setuptools/command/egg_info.py     | 8 +-------
 setuptools/dist.py                 | 9 ++-------
 setuptools/tests/test_resources.py | 6 ++----
 3 files changed, 5 insertions(+), 18 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index dfbab0e9..88ab0b82 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -11,13 +11,6 @@ import os
 import re
 import sys
 
-try:
-    import packaging.version
-except ImportError:
-    # fallback to vendored version
-    import pkg_resources._vendor.packaging.version
-    packaging = pkg_resources._vendor.packaging
-
 from setuptools import Command
 from setuptools.command.sdist import sdist
 from setuptools.compat import basestring, PY3, StringIO
@@ -28,6 +21,7 @@ from pkg_resources import (
     safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename)
 import setuptools.unicode_utils as unicode_utils
 
+from pkg_resources import packaging
 
 class egg_info(Command):
     description = "create a distribution's .egg-info directory"
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 2daa2835..7a94d4b3 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -13,18 +13,13 @@ from distutils.core import Distribution as _Distribution
 from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
     DistutilsSetupError)
 
-try:
-    import packaging.version
-except ImportError:
-    # fallback to vendored version
-    import pkg_resources._vendor.packaging.version
-    packaging = pkg_resources._vendor.packaging
-
 from setuptools.depends import Require
 from setuptools.compat import basestring, PY2
 from setuptools import windows_support
 import pkg_resources
 
+packaging = pkg_resources.packaging
+
 
 def _get_unpatched(cls):
     """Protect against re-patching the distutils if reloaded
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 7cf2385b..f9f2e459 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -8,15 +8,13 @@ import tempfile
 import shutil
 from unittest import TestCase
 
-import pkg_resources._vendor.packaging.version
-import pkg_resources._vendor.packaging.specifiers
-packaging = pkg_resources._vendor.packaging
-
 import pkg_resources
 from pkg_resources import (parse_requirements, VersionConflict, parse_version,
     Distribution, EntryPoint, Requirement, safe_version, safe_name,
     WorkingSet)
 
+packaging = pkg_resources.packaging
+
 from setuptools.command.easy_install import (get_script_header, is_sh,
     nt_quote_arg)
 from setuptools.compat import StringIO, iteritems, PY3
-- 
cgit v1.2.1


From b22fd831fd0bf735beb1ea97f630d8fb1c4c5158 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Dec 2014 17:23:39 -0500
Subject: Bumped to 8.3 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 5adfd0a3..de8c596a 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.2.2'
+__version__ = '8.3'
-- 
cgit v1.2.1


From 21f753919f89bd6c7f3333a6b15f0d5515ecde64 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Dec 2014 17:24:44 -0500
Subject: Bumped to 8.4 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index de8c596a..60a9e0b2 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.3'
+__version__ = '8.4'
-- 
cgit v1.2.1


From a7e5648bda737683c4ad220e61c44c1d17b73d87 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Dec 2014 18:25:45 -0500
Subject: Removed svn support from setuptools. Ref #313.

---
 setuptools/command/egg_info.py    |   8 +-
 setuptools/command/sdist.py       |  57 ----
 setuptools/svn_utils.py           | 585 --------------------------------------
 setuptools/tests/environment.py   |  58 ----
 setuptools/tests/test_egg_info.py | 191 +------------
 setuptools/tests/test_sdist.py    | 134 +--------
 setuptools/tests/test_svn.py      | 245 ----------------
 7 files changed, 9 insertions(+), 1269 deletions(-)
 delete mode 100644 setuptools/svn_utils.py
 delete mode 100644 setuptools/tests/test_svn.py

(limited to 'setuptools')

diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 88ab0b82..526e0a8f 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -11,10 +11,14 @@ import os
 import re
 import sys
 
+try:
+    from setuptools_svn import svn_utils
+except ImportError:
+    pass
+
 from setuptools import Command
 from setuptools.command.sdist import sdist
 from setuptools.compat import basestring, PY3, StringIO
-from setuptools import svn_utils
 from setuptools.command.sdist import walk_revctrl
 from pkg_resources import (
     parse_requirements, safe_name, parse_version,
@@ -190,6 +194,8 @@ class egg_info(Command):
 
     @staticmethod
     def get_svn_revision():
+        if 'svn_utils' not in globals():
+            return "0"
         return str(svn_utils.SvnInfo.load(os.curdir).get_revision())
 
     def find_sources(self):
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index a77c39f2..371bf547 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -1,12 +1,9 @@
 from glob import glob
-from distutils.util import convert_path
 from distutils import log
 import distutils.command.sdist as orig
 import os
-import re
 import sys
 
-from setuptools import svn_utils
 from setuptools.compat import PY3
 from setuptools.utils import cs_path_exists
 
@@ -22,60 +19,6 @@ def walk_revctrl(dirname=''):
             yield item
 
 
-# TODO will need test case
-class re_finder(object):
-    """
-    Finder that locates files based on entries in a file matched by a
-    regular expression.
-    """
-
-    def __init__(self, path, pattern, postproc=lambda x: x):
-        self.pattern = pattern
-        self.postproc = postproc
-        self.entries_path = convert_path(path)
-
-    def _finder(self, dirname, filename):
-        f = open(filename, 'rU')
-        try:
-            data = f.read()
-        finally:
-            f.close()
-        for match in self.pattern.finditer(data):
-            path = match.group(1)
-            # postproc was formerly used when the svn finder
-            # was an re_finder for calling unescape
-            path = self.postproc(path)
-            yield svn_utils.joinpath(dirname, path)
-
-    def find(self, dirname=''):
-        path = svn_utils.joinpath(dirname, self.entries_path)
-
-        if not os.path.isfile(path):
-            # entries file doesn't exist
-            return
-        for path in self._finder(dirname, path):
-            if os.path.isfile(path):
-                yield path
-            elif os.path.isdir(path):
-                for item in self.find(path):
-                    yield item
-
-    __call__ = find
-
-
-def _default_revctrl(dirname=''):
-    'Primary svn_cvs entry point'
-    for finder in finders:
-        for item in finder(dirname):
-            yield item
-
-
-finders = [
-    re_finder('CVS/Entries', re.compile(r"^\w?/([^/]+)/", re.M)),
-    svn_utils.svn_finder,
-]
-
-
 class sdist(orig.sdist):
     """Smart sdist that finds anything supported by revision control"""
 
diff --git a/setuptools/svn_utils.py b/setuptools/svn_utils.py
deleted file mode 100644
index 6502fc98..00000000
--- a/setuptools/svn_utils.py
+++ /dev/null
@@ -1,585 +0,0 @@
-from __future__ import absolute_import
-
-import os
-import re
-import sys
-from distutils import log
-import xml.dom.pulldom
-import shlex
-import locale
-import codecs
-import unicodedata
-import warnings
-from setuptools.compat import unicode, PY2
-from setuptools.py31compat import TemporaryDirectory
-from xml.sax.saxutils import unescape
-
-try:
-    import urlparse
-except ImportError:
-    import urllib.parse as urlparse
-
-from subprocess import Popen as _Popen, PIPE as _PIPE
-
-#NOTE: Use of the command line options require SVN 1.3 or newer (December 2005)
-#      and SVN 1.3 hasn't been supported by the developers since mid 2008.
-
-#subprocess is called several times with shell=(sys.platform=='win32')
-#see the follow for more information:
-#       http://bugs.python.org/issue8557
-#       http://stackoverflow.com/questions/5658622/
-#              python-subprocess-popen-environment-path
-
-def _run_command(args, stdout=_PIPE, stderr=_PIPE, encoding=None, stream=0):
-    #regarding the shell argument, see: http://bugs.python.org/issue8557
-    try:
-        proc = _Popen(args, stdout=stdout, stderr=stderr,
-                      shell=(sys.platform == 'win32'))
-
-        data = proc.communicate()[stream]
-    except OSError:
-        return 1, ''
-
-    #doubled checked and
-    data = decode_as_string(data, encoding)
-
-    #communciate calls wait()
-    return proc.returncode, data
-
-
-def _get_entry_schedule(entry):
-    schedule = entry.getElementsByTagName('schedule')[0]
-    return "".join([t.nodeValue
-                    for t in schedule.childNodes
-                    if t.nodeType == t.TEXT_NODE])
-
-
-def _get_target_property(target):
-    property_text = target.getElementsByTagName('property')[0]
-    return "".join([t.nodeValue
-                    for t in property_text.childNodes
-                    if t.nodeType == t.TEXT_NODE])
-
-
-def _get_xml_data(decoded_str):
-    if PY2:
-        #old versions want an encoded string
-        data = decoded_str.encode('utf-8')
-    else:
-        data = decoded_str
-    return data
-
-
-def joinpath(prefix, *suffix):
-    if not prefix or prefix == '.':
-        return os.path.join(*suffix)
-    return os.path.join(prefix, *suffix)
-
-def determine_console_encoding():
-    try:
-        #try for the preferred encoding
-        encoding = locale.getpreferredencoding()
-
-        #see if the locale.getdefaultlocale returns null
-        #some versions of python\platforms return US-ASCII
-        #when it cannot determine an encoding
-        if not encoding or encoding == "US-ASCII":
-            encoding = locale.getdefaultlocale()[1]
-
-        if encoding:
-            codecs.lookup(encoding)  # make sure a lookup error is not made
-
-    except (locale.Error, LookupError):
-        encoding = None
-
-    is_osx = sys.platform == "darwin"
-    if not encoding:
-        return ["US-ASCII", "utf-8"][is_osx]
-    elif encoding.startswith("mac-") and is_osx:
-        #certain versions of python would return mac-roman as default
-        #OSX as a left over of earlier mac versions.
-        return "utf-8"
-    else:
-        return encoding
-
-_console_encoding = determine_console_encoding()
-
-def decode_as_string(text, encoding=None):
-    """
-    Decode the console or file output explicitly using getpreferredencoding.
-    The text paraemeter should be a encoded string, if not no decode occurs
-    If no encoding is given, getpreferredencoding is used.  If encoding is
-    specified, that is used instead.  This would be needed for SVN --xml
-    output.  Unicode is explicitly put in composed NFC form.
-
-    --xml should be UTF-8 (SVN Issue 2938) the discussion on the Subversion
-    DEV List from 2007 seems to indicate the same.
-    """
-    #text should be a byte string
-
-    if encoding is None:
-        encoding = _console_encoding
-
-    if not isinstance(text, unicode):
-        text = text.decode(encoding)
-
-    text = unicodedata.normalize('NFC', text)
-
-    return text
-
-
-def parse_dir_entries(decoded_str):
-    '''Parse the entries from a recursive info xml'''
-    doc = xml.dom.pulldom.parseString(_get_xml_data(decoded_str))
-    entries = list()
-
-    for event, node in doc:
-        if event == 'START_ELEMENT' and node.nodeName == 'entry':
-            doc.expandNode(node)
-            if not _get_entry_schedule(node).startswith('delete'):
-                entries.append((node.getAttribute('path'),
-                                node.getAttribute('kind')))
-
-    return entries[1:]  # do not want the root directory
-
-
-def parse_externals_xml(decoded_str, prefix=''):
-    '''Parse a propget svn:externals xml'''
-    prefix = os.path.normpath(prefix)
-    prefix = os.path.normcase(prefix)
-
-    doc = xml.dom.pulldom.parseString(_get_xml_data(decoded_str))
-    externals = list()
-
-    for event, node in doc:
-        if event == 'START_ELEMENT' and node.nodeName == 'target':
-            doc.expandNode(node)
-            path = os.path.normpath(node.getAttribute('path'))
-
-            if os.path.normcase(path).startswith(prefix):
-                path = path[len(prefix)+1:]
-
-            data = _get_target_property(node)
-            #data should be decoded already
-            for external in parse_external_prop(data):
-                externals.append(joinpath(path, external))
-
-    return externals  # do not want the root directory
-
-
-def parse_external_prop(lines):
-    """
-    Parse the value of a retrieved svn:externals entry.
-
-    possible token setups (with quotng and backscaping in laters versions)
-        URL[@#] EXT_FOLDERNAME
-        [-r#] URL EXT_FOLDERNAME
-        EXT_FOLDERNAME [-r#] URL
-    """
-    externals = []
-    for line in lines.splitlines():
-        line = line.lstrip()  # there might be a "\ "
-        if not line:
-            continue
-
-        if PY2:
-            #shlex handles NULLs just fine and shlex in 2.7 tries to encode
-            #as ascii automatiically
-            line = line.encode('utf-8')
-        line = shlex.split(line)
-        if PY2:
-            line = [x.decode('utf-8') for x in line]
-
-        #EXT_FOLDERNAME is either the first or last depending on where
-        #the URL falls
-        if urlparse.urlsplit(line[-1])[0]:
-            external = line[0]
-        else:
-            external = line[-1]
-
-        external = decode_as_string(external, encoding="utf-8")
-        externals.append(os.path.normpath(external))
-
-    return externals
-
-
-def parse_prop_file(filename, key):
-    found = False
-    f = open(filename, 'rt')
-    data = ''
-    try:
-        for line in iter(f.readline, ''):    # can't use direct iter!
-            parts = line.split()
-            if len(parts) == 2:
-                kind, length = parts
-                data = f.read(int(length))
-                if kind == 'K' and data == key:
-                    found = True
-                elif kind == 'V' and found:
-                    break
-    finally:
-        f.close()
-
-    return data
-
-
-class SvnInfo(object):
-    '''
-    Generic svn_info object.  No has little knowledge of how to extract
-    information.  Use cls.load to instatiate according svn version.
-
-    Paths are not filesystem encoded.
-    '''
-
-    @staticmethod
-    def get_svn_version():
-        # Temp config directory should be enough to check for repository
-        # This is needed because .svn always creates .subversion and
-        # some operating systems do not handle dot directory correctly.
-        # Real queries in real svn repos with be concerned with it creation
-        with TemporaryDirectory() as tempdir:
-            code, data = _run_command(['svn',
-                                       '--config-dir', tempdir,
-                                       '--version',
-                                       '--quiet'])
-
-        if code == 0 and data:
-            return data.strip()
-        else:
-            return ''
-
-    #svnversion return values (previous implementations return max revision)
-    #   4123:4168     mixed revision working copy
-    #   4168M         modified working copy
-    #   4123S         switched working copy
-    #   4123:4168MS   mixed revision, modified, switched working copy
-    revision_re = re.compile(r'(?:([\-0-9]+):)?(\d+)([a-z]*)\s*$', re.I)
-
-    @classmethod
-    def load(cls, dirname=''):
-        normdir = os.path.normpath(dirname)
-
-        # Temp config directory should be enough to check for repository
-        # This is needed because .svn always creates .subversion and
-        # some operating systems do not handle dot directory correctly.
-        # Real queries in real svn repos with be concerned with it creation
-        with TemporaryDirectory() as tempdir:
-            code, data = _run_command(['svn',
-                                       '--config-dir', tempdir,
-                                       'info', normdir])
-
-        # Must check for some contents, as some use empty directories
-        # in testcases, however only enteries is needed also the info
-        # command above MUST have worked
-        svn_dir = os.path.join(normdir, '.svn')
-        is_svn_wd = (not code or
-                     os.path.isfile(os.path.join(svn_dir, 'entries')))
-
-        svn_version = tuple(cls.get_svn_version().split('.'))
-
-        try:
-            base_svn_version = tuple(int(x) for x in svn_version[:2])
-        except ValueError:
-            base_svn_version = tuple()
-
-        if not is_svn_wd:
-            #return an instance of this NO-OP class
-            return SvnInfo(dirname)
-
-        if code or not base_svn_version or base_svn_version < (1, 3):
-            warnings.warn(("No SVN 1.3+ command found: falling back "
-                           "on pre 1.7 .svn parsing"), DeprecationWarning)
-            return SvnFileInfo(dirname)
-
-        if base_svn_version < (1, 5):
-            return Svn13Info(dirname)
-
-        return Svn15Info(dirname)
-
-    def __init__(self, path=''):
-        self.path = path
-        self._entries = None
-        self._externals = None
-
-    def get_revision(self):
-        'Retrieve the directory revision information using svnversion'
-        code, data = _run_command(['svnversion', '-c', self.path])
-        if code:
-            log.warn("svnversion failed")
-            return 0
-
-        parsed = self.revision_re.match(data)
-        if parsed:
-            return int(parsed.group(2))
-        else:
-            return 0
-
-    @property
-    def entries(self):
-        if self._entries is None:
-            self._entries = self.get_entries()
-        return self._entries
-
-    @property
-    def externals(self):
-        if self._externals is None:
-            self._externals = self.get_externals()
-        return self._externals
-
-    def iter_externals(self):
-        '''
-        Iterate over the svn:external references in the repository path.
-        '''
-        for item in self.externals:
-            yield item
-
-    def iter_files(self):
-        '''
-        Iterate over the non-deleted file entries in the repository path
-        '''
-        for item, kind in self.entries:
-            if kind.lower() == 'file':
-                yield item
-
-    def iter_dirs(self, include_root=True):
-        '''
-        Iterate over the non-deleted file entries in the repository path
-        '''
-        if include_root:
-            yield self.path
-        for item, kind in self.entries:
-            if kind.lower() == 'dir':
-                yield item
-
-    def get_entries(self):
-        return []
-
-    def get_externals(self):
-        return []
-
-
-class Svn13Info(SvnInfo):
-    def get_entries(self):
-        code, data = _run_command(['svn', 'info', '-R', '--xml', self.path],
-                                  encoding="utf-8")
-
-        if code:
-            log.debug("svn info failed")
-            return []
-
-        return parse_dir_entries(data)
-
-    def get_externals(self):
-        #Previous to 1.5 --xml was not supported for svn propget and the -R
-        #output format breaks the shlex compatible semantics.
-        cmd = ['svn', 'propget', 'svn:externals']
-        result = []
-        for folder in self.iter_dirs():
-            code, lines = _run_command(cmd + [folder], encoding="utf-8")
-            if code != 0:
-                log.warn("svn propget failed")
-                return []
-            #lines should a str
-            for external in parse_external_prop(lines):
-                if folder:
-                    external = os.path.join(folder, external)
-                result.append(os.path.normpath(external))
-
-        return result
-
-
-class Svn15Info(Svn13Info):
-    def get_externals(self):
-        cmd = ['svn', 'propget', 'svn:externals', self.path, '-R', '--xml']
-        code, lines = _run_command(cmd, encoding="utf-8")
-        if code:
-            log.debug("svn propget failed")
-            return []
-        return parse_externals_xml(lines, prefix=os.path.abspath(self.path))
-
-
-class SvnFileInfo(SvnInfo):
-
-    def __init__(self, path=''):
-        super(SvnFileInfo, self).__init__(path)
-        self._directories = None
-        self._revision = None
-
-    def _walk_svn(self, base):
-        entry_file = joinpath(base, '.svn', 'entries')
-        if os.path.isfile(entry_file):
-            entries = SVNEntriesFile.load(base)
-            yield (base, False, entries.parse_revision())
-            for path in entries.get_undeleted_records():
-                path = decode_as_string(path)
-                path = joinpath(base, path)
-                if os.path.isfile(path):
-                    yield (path, True, None)
-                elif os.path.isdir(path):
-                    for item in self._walk_svn(path):
-                        yield item
-
-    def _build_entries(self):
-        entries = list()
-
-        rev = 0
-        for path, isfile, dir_rev in self._walk_svn(self.path):
-            if isfile:
-                entries.append((path, 'file'))
-            else:
-                entries.append((path, 'dir'))
-                rev = max(rev, dir_rev)
-
-        self._entries = entries
-        self._revision = rev
-
-    def get_entries(self):
-        if self._entries is None:
-            self._build_entries()
-        return self._entries
-
-    def get_revision(self):
-        if self._revision is None:
-            self._build_entries()
-        return self._revision
-
-    def get_externals(self):
-        prop_files = [['.svn', 'dir-prop-base'],
-                      ['.svn', 'dir-props']]
-        externals = []
-
-        for dirname in self.iter_dirs():
-            prop_file = None
-            for rel_parts in prop_files:
-                filename = joinpath(dirname, *rel_parts)
-                if os.path.isfile(filename):
-                    prop_file = filename
-
-            if prop_file is not None:
-                ext_prop = parse_prop_file(prop_file, 'svn:externals')
-                #ext_prop should be utf-8 coming from svn:externals
-                ext_prop = decode_as_string(ext_prop, encoding="utf-8")
-                externals.extend(parse_external_prop(ext_prop))
-
-        return externals
-
-
-def svn_finder(dirname=''):
-    #combined externals due to common interface
-    #combined externals and entries due to lack of dir_props in 1.7
-    info = SvnInfo.load(dirname)
-    for path in info.iter_files():
-        yield path
-
-    for path in info.iter_externals():
-        sub_info = SvnInfo.load(path)
-        for sub_path in sub_info.iter_files():
-            yield sub_path
-
-
-class SVNEntriesFile(object):
-    def __init__(self, data):
-        self.data = data
-
-    @classmethod
-    def load(class_, base):
-        filename = os.path.join(base, '.svn', 'entries')
-        f = open(filename)
-        try:
-            result = SVNEntriesFile.read(f)
-        finally:
-            f.close()
-        return result
-
-    @classmethod
-    def read(class_, fileobj):
-        data = fileobj.read()
-        is_xml = data.startswith(' revision_line_number
-                and section[revision_line_number])
-        ]
-        return rev_numbers
-
-    def get_undeleted_records(self):
-        undeleted = lambda s: s and s[0] and (len(s) < 6 or s[5] != 'delete')
-        result = [
-            section[0]
-            for section in self.get_sections()
-            if undeleted(section)
-        ]
-        return result
-
-
-class SVNEntriesFileXML(SVNEntriesFile):
-    def is_valid(self):
-        return True
-
-    def get_url(self):
-        "Get repository URL"
-        urlre = re.compile('url="([^"]+)"')
-        return urlre.search(self.data).group(1)
-
-    def parse_revision_numbers(self):
-        revre = re.compile(r'committed-rev="(\d+)"')
-        return [
-            int(m.group(1))
-            for m in revre.finditer(self.data)
-        ]
-
-    def get_undeleted_records(self):
-        entries_pattern = \
-            re.compile(r'name="([^"]+)"(?![^>]+deleted="true")', re.I)
-        results = [
-            unescape(match.group(1))
-            for match in entries_pattern.finditer(self.data)
-        ]
-        return results
-
-
-if __name__ == '__main__':
-    for name in svn_finder(sys.argv[1]):
-        print(name)
diff --git a/setuptools/tests/environment.py b/setuptools/tests/environment.py
index c8d0e669..a23c0504 100644
--- a/setuptools/tests/environment.py
+++ b/setuptools/tests/environment.py
@@ -1,68 +1,10 @@
 import os
-import zipfile
 import sys
-import tempfile
-import unittest
-import shutil
-import stat
 import unicodedata
 
 from subprocess import Popen as _Popen, PIPE as _PIPE
 
 
-def _remove_dir(target):
-
-    #on windows this seems to a problem
-    for dir_path, dirs, files in os.walk(target):
-        os.chmod(dir_path, stat.S_IWRITE)
-        for filename in files:
-            os.chmod(os.path.join(dir_path, filename), stat.S_IWRITE)
-    shutil.rmtree(target)
-
-
-class ZippedEnvironment(unittest.TestCase):
-
-    datafile = None
-    dataname = None
-    old_cwd = None
-
-    def setUp(self):
-        if self.datafile is None or self.dataname is None:
-            return
-
-        if not os.path.isfile(self.datafile):
-            self.old_cwd = None
-            return
-
-        self.old_cwd = os.getcwd()
-
-        self.temp_dir = tempfile.mkdtemp()
-        zip_file, source, target = [None, None, None]
-        try:
-            zip_file = zipfile.ZipFile(self.datafile)
-            for files in zip_file.namelist():
-                zip_file.extract(files, self.temp_dir)
-        finally:
-            if zip_file:
-                zip_file.close()
-            del zip_file
-
-        os.chdir(os.path.join(self.temp_dir, self.dataname))
-
-    def tearDown(self):
-        #Assume setUp was never completed
-        if self.dataname is None or self.datafile is None:
-            return
-
-        try:
-            if self.old_cwd:
-                os.chdir(self.old_cwd)
-                _remove_dir(self.temp_dir)
-        except OSError:
-            #sigh?
-            pass
-
-
 def _which_dirs(cmd):
     result = set()
     for path in os.environ.get('PATH', '').split(os.pathsep):
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index e8068420..6b4d917f 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,28 +1,16 @@
-
-import distutils.core
 import os
-import sys
 import tempfile
 import shutil
 import stat
 import unittest
 
-import pkg_resources
-import warnings
-from setuptools.command import egg_info
-from setuptools import svn_utils
-from setuptools.tests import environment, test_svn
-from setuptools.tests.py26compat import skipIf
-
-ENTRIES_V10 = pkg_resources.resource_string(__name__, 'entries-v10')
-"An entries file generated with svn 1.6.17 against the legacy Setuptools repo"
+from . import environment
 
 
 class TestEggInfo(unittest.TestCase):
 
     def setUp(self):
         self.test_dir = tempfile.mkdtemp()
-        os.mkdir(os.path.join(self.test_dir, '.svn'))
 
         self.old_cwd = os.getcwd()
         os.chdir(self.test_dir)
@@ -31,12 +19,6 @@ class TestEggInfo(unittest.TestCase):
         os.chdir(self.old_cwd)
         shutil.rmtree(self.test_dir)
 
-    def _write_entries(self, entries):
-        fn = os.path.join(self.test_dir, '.svn', 'entries')
-        entries_f = open(fn, 'wb')
-        entries_f.write(entries)
-        entries_f.close()
-
     def _create_project(self):
         with open('setup.py', 'w') as f:
             f.write('from setuptools import setup\n')
@@ -51,52 +33,6 @@ class TestEggInfo(unittest.TestCase):
             f.write('def run():\n')
             f.write("    print('hello')\n")
 
-    @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
-    def test_version_10_format(self):
-        """
-        """
-        #keeping this set for 1.6 is a good check on the get_svn_revision
-        #to ensure I return using svnversion what would had been returned
-        version_str = svn_utils.SvnInfo.get_svn_version()
-        version = [int(x) for x in version_str.split('.')[:2]]
-        if version != [1, 6]:
-            if hasattr(self, 'skipTest'):
-                self.skipTest('')
-            else:
-                sys.stderr.write('\n   Skipping due to SVN Version\n')
-                return
-
-        self._write_entries(ENTRIES_V10)
-        rev = egg_info.egg_info.get_svn_revision()
-        self.assertEqual(rev, '89000')
-
-    def test_version_10_format_legacy_parser(self):
-        """
-        """
-        path_variable = None
-        for env in os.environ:
-            if env.lower() == 'path':
-                path_variable = env
-
-        if path_variable:
-            old_path = os.environ[path_variable]
-            os.environ[path_variable] = ''
-        #catch_warnings not available until py26
-        warning_filters = warnings.filters
-        warnings.filters = warning_filters[:]
-        try:
-            warnings.simplefilter("ignore", DeprecationWarning)
-            self._write_entries(ENTRIES_V10)
-            rev = egg_info.egg_info.get_svn_revision()
-        finally:
-            #restore the warning filters
-            warnings.filters = warning_filters
-            #restore the os path
-            if path_variable:
-                os.environ[path_variable] = old_path
-
-        self.assertEqual(rev, '89000')
-
     def test_egg_base_installed_egg_info(self):
         self._create_project()
         temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
@@ -139,130 +75,5 @@ class TestEggInfo(unittest.TestCase):
             shutil.rmtree(temp_dir)
 
 
-DUMMY_SOURCE_TXT = """CHANGES.txt
-CONTRIBUTORS.txt
-HISTORY.txt
-LICENSE
-MANIFEST.in
-README.txt
-setup.py
-dummy/__init__.py
-dummy/test.txt
-dummy.egg-info/PKG-INFO
-dummy.egg-info/SOURCES.txt
-dummy.egg-info/dependency_links.txt
-dummy.egg-info/top_level.txt"""
-
-
-class TestSvnDummy(environment.ZippedEnvironment):
-
-    def setUp(self):
-        version = svn_utils.SvnInfo.get_svn_version()
-        if not version:  # None or Empty
-            return None
-
-        self.base_version = tuple([int(x) for x in version.split('.')][:2])
-
-        if not self.base_version:
-            raise ValueError('No SVN tools installed')
-        elif self.base_version < (1, 3):
-            raise ValueError('Insufficient SVN Version %s' % version)
-        elif self.base_version >= (1, 9):
-            #trying the latest version
-            self.base_version = (1, 8)
-
-        self.dataname = "dummy%i%i" % self.base_version
-        self.datafile = os.path.join('setuptools', 'tests',
-                                     'svn_data', self.dataname + ".zip")
-        super(TestSvnDummy, self).setUp()
-
-    @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
-    def test_sources(self):
-        code, data = environment.run_setup_py(["sdist"],
-                                              pypath=self.old_cwd,
-                                              data_stream=1)
-        if code:
-            raise AssertionError(data)
-
-        sources = os.path.join('dummy.egg-info', 'SOURCES.txt')
-        infile = open(sources, 'r')
-        try:
-            read_contents = infile.read()
-        finally:
-            infile.close()
-            del infile
-
-        self.assertEqual(DUMMY_SOURCE_TXT, read_contents)
-
-        return data
-
-    @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
-    def test_svn_tags(self):
-        code, data = environment.run_setup_py(["egg_info",
-                                               "--tag-svn-revision"],
-                                              pypath=self.old_cwd,
-                                              data_stream=1)
-        if code:
-            raise AssertionError(data)
-
-        pkginfo = os.path.join('dummy.egg-info', 'PKG-INFO')
-        infile = open(pkginfo, 'r')
-        try:
-            read_contents = infile.readlines()
-        finally:
-            infile.close()
-            del infile
-
-        self.assertTrue("Version: 0.1.1.post1\n" in read_contents)
-
-    @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
-    def test_no_tags(self):
-        code, data = environment.run_setup_py(["egg_info"],
-                                              pypath=self.old_cwd,
-                                              data_stream=1)
-        if code:
-            raise AssertionError(data)
-
-        pkginfo = os.path.join('dummy.egg-info', 'PKG-INFO')
-        infile = open(pkginfo, 'r')
-        try:
-            read_contents = infile.readlines()
-        finally:
-            infile.close()
-            del infile
-
-        self.assertTrue("Version: 0.1.1\n" in read_contents)
-
-
-class TestSvnDummyLegacy(environment.ZippedEnvironment):
-
-    def setUp(self):
-        self.base_version = (1, 6)
-        self.dataname = "dummy%i%i" % self.base_version
-        self.datafile = os.path.join('setuptools', 'tests',
-                                     'svn_data', self.dataname + ".zip")
-        super(TestSvnDummyLegacy, self).setUp()
-
-    def test_sources(self):
-        code, data = environment.run_setup_py(["sdist"],
-                                              pypath=self.old_cwd,
-                                              path="",
-                                              data_stream=1)
-        if code:
-            raise AssertionError(data)
-
-        sources = os.path.join('dummy.egg-info', 'SOURCES.txt')
-        infile = open(sources, 'r')
-        try:
-            read_contents = infile.read()
-        finally:
-            infile.close()
-            del infile
-
-        self.assertEqual(DUMMY_SOURCE_TXT, read_contents)
-
-        return data
-
-
 def test_suite():
     return unittest.defaultTestLoader.loadTestsFromName(__name__)
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 5f8a190f..bece76d2 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -8,16 +8,13 @@ import sys
 import tempfile
 import unittest
 import unicodedata
-import re
 import contextlib
-from setuptools.tests import environment, test_svn
 from setuptools.tests.py26compat import skipIf
 
 from setuptools.compat import StringIO, unicode, PY3, PY2
-from setuptools.command.sdist import sdist, walk_revctrl
+from setuptools.command.sdist import sdist
 from setuptools.command.egg_info import manifest_maker
 from setuptools.dist import Distribution
-from setuptools import svn_utils
 
 SETUP_ATTRS = {
     'name': 'sdist_test',
@@ -418,135 +415,6 @@ class TestSdistTest(unittest.TestCase):
             except UnicodeDecodeError:
                 self.assertFalse(filename in cmd.filelist.files)
 
-class TestDummyOutput(environment.ZippedEnvironment):
-
-    def setUp(self):
-        self.datafile = os.path.join('setuptools', 'tests',
-                                     'svn_data', "dummy.zip")
-        self.dataname = "dummy"
-        super(TestDummyOutput, self).setUp()
-
-    def _run(self):
-        code, data = environment.run_setup_py(["sdist"],
-                                              pypath=self.old_cwd,
-                                              data_stream=0)
-        if code:
-            info = "DIR: " + os.path.abspath('.')
-            info += "\n  SDIST RETURNED: %i\n\n" % code
-            info += data
-            raise AssertionError(info)
-
-        datalines = data.splitlines()
-
-        possible = (
-            "running sdist",
-            "running egg_info",
-            "creating dummy\.egg-info",
-            "writing dummy\.egg-info",
-            "writing top-level names to dummy\.egg-info",
-            "writing dependency_links to dummy\.egg-info",
-            "writing manifest file 'dummy\.egg-info",
-            "reading manifest file 'dummy\.egg-info",
-            "reading manifest template 'MANIFEST\.in'",
-            "writing manifest file 'dummy\.egg-info",
-            "creating dummy-0.1.1",
-            "making hard links in dummy-0\.1\.1",
-            "copying files to dummy-0\.1\.1",
-            "copying \S+ -> dummy-0\.1\.1",
-            "copying dummy",
-            "copying dummy\.egg-info",
-            "hard linking \S+ -> dummy-0\.1\.1",
-            "hard linking dummy",
-            "hard linking dummy\.egg-info",
-            "Writing dummy-0\.1\.1",
-            "creating dist",
-            "creating 'dist",
-            "Creating tar archive",
-            "running check",
-            "adding 'dummy-0\.1\.1",
-            "tar .+ dist/dummy-0\.1\.1\.tar dummy-0\.1\.1",
-            "gzip .+ dist/dummy-0\.1\.1\.tar",
-            "removing 'dummy-0\.1\.1' \\(and everything under it\\)",
-        )
-
-        print("    DIR: " + os.path.abspath('.'))
-        for line in datalines:
-            found = False
-            for pattern in possible:
-                if re.match(pattern, line):
-                    print("   READ: " + line)
-                    found = True
-                    break
-            if not found:
-                raise AssertionError("Unexpexected: %s\n-in-\n%s"
-                                     % (line, data))
-
-        return data
-
-    def test_sources(self):
-        self._run()
-
-
-class TestSvn(environment.ZippedEnvironment):
-
-    def setUp(self):
-        version = svn_utils.SvnInfo.get_svn_version()
-        if not version:  # None or Empty
-            return
-
-        self.base_version = tuple([int(x) for x in version.split('.')][:2])
-
-        if not self.base_version:
-            raise ValueError('No SVN tools installed')
-        elif self.base_version < (1, 3):
-            raise ValueError('Insufficient SVN Version %s' % version)
-        elif self.base_version >= (1, 9):
-            # trying the latest version
-            self.base_version = (1, 8)
-
-        self.dataname = "svn%i%i_example" % self.base_version
-        self.datafile = os.path.join('setuptools', 'tests',
-                                     'svn_data', self.dataname + ".zip")
-        super(TestSvn, self).setUp()
-
-    @skipIf(not test_svn._svn_check, "No SVN to text, in the first place")
-    def test_walksvn(self):
-        if self.base_version >= (1, 6):
-            folder2 = 'third party2'
-            folder3 = 'third party3'
-        else:
-            folder2 = 'third_party2'
-            folder3 = 'third_party3'
-
-        # TODO is this right
-        expected = set([
-            os.path.join('a file'),
-            os.path.join(folder2, 'Changes.txt'),
-            os.path.join(folder2, 'MD5SUMS'),
-            os.path.join(folder2, 'README.txt'),
-            os.path.join(folder3, 'Changes.txt'),
-            os.path.join(folder3, 'MD5SUMS'),
-            os.path.join(folder3, 'README.txt'),
-            os.path.join(folder3, 'TODO.txt'),
-            os.path.join(folder3, 'fin'),
-            os.path.join('third_party', 'README.txt'),
-            os.path.join('folder', folder2, 'Changes.txt'),
-            os.path.join('folder', folder2, 'MD5SUMS'),
-            os.path.join('folder', folder2, 'WatashiNiYomimasu.txt'),
-            os.path.join('folder', folder3, 'Changes.txt'),
-            os.path.join('folder', folder3, 'fin'),
-            os.path.join('folder', folder3, 'MD5SUMS'),
-            os.path.join('folder', folder3, 'oops'),
-            os.path.join('folder', folder3, 'WatashiNiYomimasu.txt'),
-            os.path.join('folder', folder3, 'ZuMachen.txt'),
-            os.path.join('folder', 'third_party', 'WatashiNiYomimasu.txt'),
-            os.path.join('folder', 'lalala.txt'),
-            os.path.join('folder', 'quest.txt'),
-            # The example will have a deleted file
-            #  (or should) but shouldn't return it
-        ])
-        self.assertEqual(set(x for x in walk_revctrl()), expected)
-
 
 def test_suite():
     return unittest.defaultTestLoader.loadTestsFromName(__name__)
diff --git a/setuptools/tests/test_svn.py b/setuptools/tests/test_svn.py
deleted file mode 100644
index 33400362..00000000
--- a/setuptools/tests/test_svn.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# -*- coding: utf-8 -*-
-"""svn tests"""
-
-import io
-import os
-import subprocess
-import sys
-import unittest
-from setuptools.tests import environment
-from setuptools.compat import unicode, unichr
-
-from setuptools import svn_utils
-from setuptools.tests.py26compat import skipIf
-
-
-def _do_svn_check():
-    try:
-        subprocess.check_call(["svn", "--version"],
-                              shell=(sys.platform == 'win32'))
-        return True
-    except (OSError, subprocess.CalledProcessError):
-        return False
-_svn_check = _do_svn_check()
-
-
-class TestSvnVersion(unittest.TestCase):
-
-    def test_no_svn_found(self):
-        path_variable = None
-        for env in os.environ:
-            if env.lower() == 'path':
-                path_variable = env
-
-        if path_variable is None:
-            try:
-                self.skipTest('Cannot figure out how to modify path')
-            except AttributeError:  # PY26 doesn't have this
-                return
-
-        old_path = os.environ[path_variable]
-        os.environ[path_variable] = ''
-        try:
-            version = svn_utils.SvnInfo.get_svn_version()
-            self.assertEqual(version, '')
-        finally:
-            os.environ[path_variable] = old_path
-
-    @skipIf(not _svn_check, "No SVN to text, in the first place")
-    def test_svn_should_exist(self):
-        version = svn_utils.SvnInfo.get_svn_version()
-        self.assertNotEqual(version, '')
-
-def _read_utf8_file(path):
-    fileobj = None
-    try:
-        fileobj = io.open(path, 'r', encoding='utf-8')
-        data = fileobj.read()
-        return data
-    finally:
-        if fileobj:
-            fileobj.close()
-
-
-class ParserInfoXML(unittest.TestCase):
-
-    def parse_tester(self, svn_name, ext_spaces):
-        path = os.path.join('setuptools', 'tests',
-                            'svn_data', svn_name + '_info.xml')
-        #Remember these are pre-generated to test XML parsing
-        #  so these paths might not valid on your system
-        example_base = "%s_example" % svn_name
-
-        data = _read_utf8_file(path)
-
-        expected = set([
-            ("\\".join((example_base, 'a file')), 'file'),
-            ("\\".join((example_base, 'folder')), 'dir'),
-            ("\\".join((example_base, 'folder', 'lalala.txt')), 'file'),
-            ("\\".join((example_base, 'folder', 'quest.txt')), 'file'),
-            ])
-        self.assertEqual(set(x for x in svn_utils.parse_dir_entries(data)),
-                         expected)
-
-    def test_svn13(self):
-        self.parse_tester('svn13', False)
-
-    def test_svn14(self):
-        self.parse_tester('svn14', False)
-
-    def test_svn15(self):
-        self.parse_tester('svn15', False)
-
-    def test_svn16(self):
-        self.parse_tester('svn16', True)
-
-    def test_svn17(self):
-        self.parse_tester('svn17', True)
-
-    def test_svn18(self):
-        self.parse_tester('svn18', True)
-
-class ParserExternalXML(unittest.TestCase):
-
-    def parse_tester(self, svn_name, ext_spaces):
-        path = os.path.join('setuptools', 'tests',
-                            'svn_data', svn_name + '_ext_list.xml')
-        example_base = svn_name + '_example'
-        data = _read_utf8_file(path)
-
-        if ext_spaces:
-            folder2 = 'third party2'
-            folder3 = 'third party3'
-        else:
-            folder2 = 'third_party2'
-            folder3 = 'third_party3'
-
-        expected = set([
-            os.sep.join((example_base, folder2)),
-            os.sep.join((example_base, folder3)),
-            # folder is third_party大介
-            os.sep.join((example_base,
-                       unicode('third_party') +
-                       unichr(0x5927) + unichr(0x4ecb))),
-            os.sep.join((example_base, 'folder', folder2)),
-            os.sep.join((example_base, 'folder', folder3)),
-            os.sep.join((example_base, 'folder',
-                       unicode('third_party') +
-                       unichr(0x5927) + unichr(0x4ecb))),
-            ])
-
-        expected = set(os.path.normpath(x) for x in expected)
-        dir_base = os.sep.join(('C:', 'development', 'svn_example'))
-        self.assertEqual(set(x for x
-            in svn_utils.parse_externals_xml(data, dir_base)), expected)
-
-    def test_svn15(self):
-        self.parse_tester('svn15', False)
-
-    def test_svn16(self):
-        self.parse_tester('svn16', True)
-
-    def test_svn17(self):
-        self.parse_tester('svn17', True)
-
-    def test_svn18(self):
-        self.parse_tester('svn18', True)
-
-
-class ParseExternal(unittest.TestCase):
-
-    def parse_tester(self, svn_name, ext_spaces):
-        path = os.path.join('setuptools', 'tests',
-                            'svn_data', svn_name + '_ext_list.txt')
-        data = _read_utf8_file(path)
-
-        if ext_spaces:
-            expected = set(['third party2', 'third party3',
-                            'third party3b', 'third_party'])
-        else:
-            expected = set(['third_party2', 'third_party3', 'third_party'])
-
-        self.assertEqual(set(x for x in svn_utils.parse_external_prop(data)),
-                         expected)
-
-    def test_svn13(self):
-        self.parse_tester('svn13', False)
-
-    def test_svn14(self):
-        self.parse_tester('svn14', False)
-
-    def test_svn15(self):
-        self.parse_tester('svn15', False)
-
-    def test_svn16(self):
-        self.parse_tester('svn16', True)
-
-    def test_svn17(self):
-        self.parse_tester('svn17', True)
-
-    def test_svn18(self):
-        self.parse_tester('svn18', True)
-
-
-class TestSvn(environment.ZippedEnvironment):
-
-    def setUp(self):
-        version = svn_utils.SvnInfo.get_svn_version()
-        if not version:  # empty or null
-            self.dataname = None
-            self.datafile = None
-            return
-
-        self.base_version = tuple([int(x) for x in version.split('.')[:2]])
-
-        if self.base_version < (1,3):
-            raise ValueError('Insufficient SVN Version %s' % version)
-        elif self.base_version >= (1,9):
-            #trying the latest version
-            self.base_version = (1,8)
-
-        self.dataname = "svn%i%i_example" % self.base_version
-        self.datafile = os.path.join('setuptools', 'tests',
-                                     'svn_data', self.dataname + ".zip")
-        super(TestSvn, self).setUp()
-
-    @skipIf(not _svn_check, "No SVN to text, in the first place")
-    def test_revision(self):
-        rev = svn_utils.SvnInfo.load('.').get_revision()
-        self.assertEqual(rev, 6)
-
-    @skipIf(not _svn_check, "No SVN to text, in the first place")
-    def test_entries(self):
-        expected = set([
-            (os.path.join('a file'), 'file'),
-            (os.path.join('folder'), 'dir'),
-            (os.path.join('folder', 'lalala.txt'), 'file'),
-            (os.path.join('folder', 'quest.txt'), 'file'),
-            #The example will have a deleted file (or should)
-            #but shouldn't return it
-            ])
-        info = svn_utils.SvnInfo.load('.')
-        self.assertEqual(set(x for x in info.entries), expected)
-
-    @skipIf(not _svn_check, "No SVN to text, in the first place")
-    def test_externals(self):
-        if self.base_version >= (1,6):
-            folder2 = 'third party2'
-            folder3 = 'third party3'
-        else:
-            folder2 = 'third_party2'
-            folder3 = 'third_party3'
-
-        expected = set([
-            os.path.join(folder2),
-            os.path.join(folder3),
-            os.path.join('third_party'),
-            os.path.join('folder', folder2),
-            os.path.join('folder', folder3),
-            os.path.join('folder', 'third_party'),
-            ])
-        info = svn_utils.SvnInfo.load('.')
-        self.assertEqual(set([x for x in info.externals]), expected)
-
-def test_suite():
-    return unittest.defaultTestLoader.loadTestsFromName(__name__)
-- 
cgit v1.2.1


From 022f37cb1b0cb2e15dc59a723731f5e7f65ea6ce Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 25 Dec 2014 09:50:31 -0500
Subject: Move api_tests to pkg_resources package. Fixes #312.

---
 setuptools/tests/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index d6a4542e..48b29c4c 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -20,7 +20,7 @@ from setuptools.depends import Require
 def additional_tests():
     suite = unittest.TestSuite((
         doctest.DocFileSuite(
-            os.path.join('tests', 'api_tests.txt'),
+            'api_tests.txt',
             optionflags=doctest.ELLIPSIS, package='pkg_resources',
             ),
         ))
-- 
cgit v1.2.1


From 9dfcbd945d5d93f75a62228deabdf6c7eff02213 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 25 Dec 2014 12:35:38 -0500
Subject: Removing test data

---
 setuptools/tests/entries-v10                 | 615 ---------------------------
 setuptools/tests/svn_data/dummy.zip          | Bin 1771 -> 0 bytes
 setuptools/tests/svn_data/dummy13.zip        | Bin 9243 -> 0 bytes
 setuptools/tests/svn_data/dummy14.zip        | Bin 7496 -> 0 bytes
 setuptools/tests/svn_data/dummy15.zip        | Bin 7506 -> 0 bytes
 setuptools/tests/svn_data/dummy16.zip        | Bin 7155 -> 0 bytes
 setuptools/tests/svn_data/dummy17.zip        | Bin 7512 -> 0 bytes
 setuptools/tests/svn_data/dummy18.zip        | Bin 7639 -> 0 bytes
 setuptools/tests/svn_data/svn13_example.zip  | Bin 48818 -> 0 bytes
 setuptools/tests/svn_data/svn13_ext_list.txt |   3 -
 setuptools/tests/svn_data/svn13_ext_list.xml |   0
 setuptools/tests/svn_data/svn13_info.xml     | 121 ------
 setuptools/tests/svn_data/svn14_example.zip  | Bin 31077 -> 0 bytes
 setuptools/tests/svn_data/svn14_ext_list.txt |   4 -
 setuptools/tests/svn_data/svn14_ext_list.xml |   0
 setuptools/tests/svn_data/svn14_info.xml     | 119 ------
 setuptools/tests/svn_data/svn15_example.zip  | Bin 31143 -> 0 bytes
 setuptools/tests/svn_data/svn15_ext_list.txt |   4 -
 setuptools/tests/svn_data/svn15_ext_list.xml |  19 -
 setuptools/tests/svn_data/svn15_info.xml     | 125 ------
 setuptools/tests/svn_data/svn16_example.zip  | Bin 29418 -> 0 bytes
 setuptools/tests/svn_data/svn16_ext_list.txt |   4 -
 setuptools/tests/svn_data/svn16_ext_list.xml |  19 -
 setuptools/tests/svn_data/svn16_info.xml     | 125 ------
 setuptools/tests/svn_data/svn17_example.zip  | Bin 46954 -> 0 bytes
 setuptools/tests/svn_data/svn17_ext_list.txt |   4 -
 setuptools/tests/svn_data/svn17_ext_list.xml |  19 -
 setuptools/tests/svn_data/svn17_info.xml     | 130 ------
 setuptools/tests/svn_data/svn18_example.zip  | Bin 47477 -> 0 bytes
 setuptools/tests/svn_data/svn18_ext_list.txt |   4 -
 setuptools/tests/svn_data/svn18_ext_list.xml |  19 -
 setuptools/tests/svn_data/svn18_info.xml     | 136 ------
 32 files changed, 1470 deletions(-)
 delete mode 100644 setuptools/tests/entries-v10
 delete mode 100644 setuptools/tests/svn_data/dummy.zip
 delete mode 100644 setuptools/tests/svn_data/dummy13.zip
 delete mode 100644 setuptools/tests/svn_data/dummy14.zip
 delete mode 100644 setuptools/tests/svn_data/dummy15.zip
 delete mode 100644 setuptools/tests/svn_data/dummy16.zip
 delete mode 100644 setuptools/tests/svn_data/dummy17.zip
 delete mode 100644 setuptools/tests/svn_data/dummy18.zip
 delete mode 100644 setuptools/tests/svn_data/svn13_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn13_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn13_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn13_info.xml
 delete mode 100644 setuptools/tests/svn_data/svn14_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn14_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn14_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn14_info.xml
 delete mode 100644 setuptools/tests/svn_data/svn15_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn15_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn15_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn15_info.xml
 delete mode 100644 setuptools/tests/svn_data/svn16_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn16_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn16_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn16_info.xml
 delete mode 100644 setuptools/tests/svn_data/svn17_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn17_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn17_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn17_info.xml
 delete mode 100644 setuptools/tests/svn_data/svn18_example.zip
 delete mode 100644 setuptools/tests/svn_data/svn18_ext_list.txt
 delete mode 100644 setuptools/tests/svn_data/svn18_ext_list.xml
 delete mode 100644 setuptools/tests/svn_data/svn18_info.xml

(limited to 'setuptools')

diff --git a/setuptools/tests/entries-v10 b/setuptools/tests/entries-v10
deleted file mode 100644
index 4446c501..00000000
--- a/setuptools/tests/entries-v10
+++ /dev/null
@@ -1,615 +0,0 @@
-10
-
-dir
-89001
-http://svn.python.org/projects/sandbox/branches/setuptools-0.6
-http://svn.python.org/projects
-
-
-
-2013-06-03T17:26:03.052972Z
-89000
-phillip.eby
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-6015fed2-1504-0410-9fe1-9d1591cc4771
-
-api_tests.txt
-file
-
-
-
-
-2013-06-19T13:20:47.948712Z
-dec366372ca14fbeaeb26f492bcf5725
-2013-05-15T22:04:59.389374Z
-88997
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-12312
-
-setuptools.egg-info
-dir
-
-README.txt
-file
-
-
-
-
-2013-06-19T13:20:47.948712Z
-26f0dd5d095522ba3ad999b6b6777b92
-2011-05-31T20:10:56.416725Z
-88846
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-7615
-
-easy_install.py
-file
-
-
-
-
-2013-06-19T13:20:47.948712Z
-97b52fe7253bf4683f9f626f015eb72e
-2006-09-20T20:48:18.716070Z
-51935
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-126
-
-setuptools
-dir
-
-launcher.c
-file
-
-
-
-
-2013-06-19T13:20:47.924700Z
-e5a8e77de9022688b80f77fc6d742fee
-2009-10-19T21:03:29.785400Z
-75544
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-7476
-
-ez_setup.py
-file
-
-
-
-
-2013-06-19T13:20:47.924700Z
-17e8ec5e08faccfcb08b5f8d5167ca14
-2011-01-20T18:50:00.815420Z
-88124
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-8350
-
-version
-file
-
-
-
-
-2013-06-19T13:20:47.924700Z
-e456da09e0c9e224a56302f8316b6dbf
-2007-01-09T19:21:05.921317Z
-53317
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1143
-
-setup.py
-file
-
-
-
-
-2013-06-19T13:20:47.924700Z
-d4e5b3c16bd61bfef6c0bb9377a3a3ea
-2013-05-15T22:04:59.389374Z
-88997
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-5228
-
-release.sh
-file
-
-
-
-
-2013-06-19T13:20:47.932704Z
-b1fd4054a1c107ff0f27baacd97be94c
-2009-10-28T17:12:45.227140Z
-75925
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1044
-
-pkg_resources.txt
-file
-
-
-
-
-2013-06-19T13:20:47.928702Z
-f497e7c92a4de207cbd9ab1943f93388
-2009-10-12T20:00:02.336146Z
-75385
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-94518
-
-site.py
-file
-
-
-
-
-2013-06-19T13:20:47.932704Z
-ebaac6fb6525f77ca950d22e6f8315df
-2006-03-11T00:39:09.666740Z
-42965
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2362
-
-version.dat
-file
-
-
-
-
-2013-06-19T13:20:47.932704Z
-8e14ecea32b9874cd7d29277494554c0
-2009-10-28T17:12:45.227140Z
-75925
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-80
-
-virtual-python.py
-file
-
-
-
-
-2013-06-19T13:20:47.932704Z
-aa857add3b5563238f0a904187f5ded9
-2005-10-17T02:26:39.000000Z
-41262
-pje
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3898
-
-setup.cfg
-file
-
-
-
-
-2013-06-19T13:20:47.932704Z
-eda883e744fce83f8107ad8dc8303536
-2006-09-21T22:26:48.050256Z
-51965
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-296
-
-setuptools.txt
-file
-
-
-
-
-2013-06-19T13:20:47.940708Z
-11926256f06046b196eaf814772504e7
-2013-05-15T22:04:59.389374Z
-88997
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-149832
-
-pkg_resources.py
-file
-
-
-
-
-2013-06-19T13:20:47.940708Z
-b63a30f5f0f0225a788c2c0e3430b3cf
-2013-05-15T22:04:59.389374Z
-88997
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-90397
-
-tests
-dir
-
-wikiup.cfg
-file
-
-
-
-
-2013-06-19T13:20:47.944710Z
-34ad845a5e0a0b46458557fa910bf429
-2008-08-21T17:23:50.797633Z
-65935
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-136
-
-EasyInstall.txt
-file
-
-
-
-
-2013-06-19T13:20:47.944710Z
-e97387c517f70fc18a377e42d19d64d4
-2013-05-15T22:04:59.389374Z
-88997
-phillip.eby
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-82495
-
diff --git a/setuptools/tests/svn_data/dummy.zip b/setuptools/tests/svn_data/dummy.zip
deleted file mode 100644
index 1347be53..00000000
Binary files a/setuptools/tests/svn_data/dummy.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy13.zip b/setuptools/tests/svn_data/dummy13.zip
deleted file mode 100644
index 47764342..00000000
Binary files a/setuptools/tests/svn_data/dummy13.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy14.zip b/setuptools/tests/svn_data/dummy14.zip
deleted file mode 100644
index 02ed8cf0..00000000
Binary files a/setuptools/tests/svn_data/dummy14.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy15.zip b/setuptools/tests/svn_data/dummy15.zip
deleted file mode 100644
index ed8daeeb..00000000
Binary files a/setuptools/tests/svn_data/dummy15.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy16.zip b/setuptools/tests/svn_data/dummy16.zip
deleted file mode 100644
index b6e98d6c..00000000
Binary files a/setuptools/tests/svn_data/dummy16.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy17.zip b/setuptools/tests/svn_data/dummy17.zip
deleted file mode 100644
index d96e1513..00000000
Binary files a/setuptools/tests/svn_data/dummy17.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/dummy18.zip b/setuptools/tests/svn_data/dummy18.zip
deleted file mode 100644
index a7267838..00000000
Binary files a/setuptools/tests/svn_data/dummy18.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn13_example.zip b/setuptools/tests/svn_data/svn13_example.zip
deleted file mode 100644
index d85fb84f..00000000
Binary files a/setuptools/tests/svn_data/svn13_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn13_ext_list.txt b/setuptools/tests/svn_data/svn13_ext_list.txt
deleted file mode 100644
index 0bb0f438..00000000
--- a/setuptools/tests/svn_data/svn13_ext_list.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-third_party3 file:///C:/development/svn_example/repos/svn13/extra1
-third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1
-third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1
diff --git a/setuptools/tests/svn_data/svn13_ext_list.xml b/setuptools/tests/svn_data/svn13_ext_list.xml
deleted file mode 100644
index e69de29b..00000000
diff --git a/setuptools/tests/svn_data/svn13_info.xml b/setuptools/tests/svn_data/svn13_info.xml
deleted file mode 100644
index 5c96520a..00000000
--- a/setuptools/tests/svn_data/svn13_info.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn13/main
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-normal
-2013-07-13T15:33:23.187500Z
-
-
-ptt
-2013-07-13T15:33:28.359375Z
-
-
-
-file:///C:/development/svn_example/repos/svn13/main/a%20file
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-normal
-2013-07-13T15:33:21.109375Z
-a6166e5e98a5a503089cde9bc8031293
-
-
-ptt
-2013-07-13T15:33:21.312500Z
-
-
-
-file:///C:/development/svn_example/repos/svn13/main/to_delete
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-delete
-2013-07-13T15:33:28.140625Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:33:28.359375Z
-
-
-
-file:///C:/development/svn_example/repos/svn13/main/folder
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-normal
-2013-07-13T15:33:26.187500Z
-
-
-ptt
-2013-07-13T15:33:26.312500Z
-
-
-
-file:///C:/development/svn_example/repos/svn13/main/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-normal
-2013-07-13T15:33:20.109375Z
-795240c6a830c14f83961e57e07dad12
-
-
-ptt
-2013-07-13T15:33:20.312500Z
-
-
-
-file:///C:/development/svn_example/repos/svn13/main/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn13/main
-d2996769-47b0-9946-b618-da1aa3eceda3
-
-
-normal
-2013-07-13T15:33:19.375000Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:33:19.609375Z
-
-
-
diff --git a/setuptools/tests/svn_data/svn14_example.zip b/setuptools/tests/svn_data/svn14_example.zip
deleted file mode 100644
index 57093c0b..00000000
Binary files a/setuptools/tests/svn_data/svn14_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn14_ext_list.txt b/setuptools/tests/svn_data/svn14_ext_list.txt
deleted file mode 100644
index 800a0965..00000000
--- a/setuptools/tests/svn_data/svn14_ext_list.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-third_party3 file:///C:/development/svn_example/repos/svn13/extra1
-third_party2 -r3 file:///C:/development/svn_example/repos/svn13/extra1
-third_party -r1 file:///C:/development/svn_example/repos/svn13/extra1
-
diff --git a/setuptools/tests/svn_data/svn14_ext_list.xml b/setuptools/tests/svn_data/svn14_ext_list.xml
deleted file mode 100644
index e69de29b..00000000
diff --git a/setuptools/tests/svn_data/svn14_info.xml b/setuptools/tests/svn_data/svn14_info.xml
deleted file mode 100644
index a896a77f..00000000
--- a/setuptools/tests/svn_data/svn14_info.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn14/main
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-normal
-
-
-ptt
-2013-07-13T15:34:14.406250Z
-
-
-
-file:///C:/development/svn_example/repos/svn14/main/a%20file
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-normal
-2013-07-13T15:34:08.109375Z
-a6166e5e98a5a503089cde9bc8031293
-
-
-ptt
-2013-07-13T15:34:08.390625Z
-
-
-
-file:///C:/development/svn_example/repos/svn14/main/to_delete
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-delete
-2013-07-13T15:34:14.125000Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:34:14.406250Z
-
-
-
-file:///C:/development/svn_example/repos/svn14/main/folder
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-normal
-
-
-ptt
-2013-07-13T15:34:12.390625Z
-
-
-
-file:///C:/development/svn_example/repos/svn14/main/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-normal
-2013-07-13T15:34:07.109375Z
-795240c6a830c14f83961e57e07dad12
-
-
-ptt
-2013-07-13T15:34:07.390625Z
-
-
-
-file:///C:/development/svn_example/repos/svn14/main/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn14/main
-c75942e5-8b7a-354d-b1cf-73dee23fa94f
-
-
-normal
-2013-07-13T15:34:06.250000Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:34:06.531250Z
-
-
-
diff --git a/setuptools/tests/svn_data/svn15_example.zip b/setuptools/tests/svn_data/svn15_example.zip
deleted file mode 100644
index 52a1d45b..00000000
Binary files a/setuptools/tests/svn_data/svn15_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn15_ext_list.txt b/setuptools/tests/svn_data/svn15_ext_list.txt
deleted file mode 100644
index 75fde4e6..00000000
--- a/setuptools/tests/svn_data/svn15_ext_list.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-third_party3 file:///C:/development/svn_example/repos/svn15/extra1
--r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2
-file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party
-
diff --git a/setuptools/tests/svn_data/svn15_ext_list.xml b/setuptools/tests/svn_data/svn15_ext_list.xml
deleted file mode 100644
index 6950b3c5..00000000
--- a/setuptools/tests/svn_data/svn15_ext_list.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-third_party3 file:///C:/development/svn_example/repos/svn15/extra2
--r3 file:///C:/development/svn_example/repos/svn15/extra2 third_party2
-file:///C:/development/svn_example/repos/svn15/extra2@r1 third_party大介
-
-
-
-third_party3 file:///C:/development/svn_example/repos/svn15/extra1
--r3 file:///C:/development/svn_example/repos/svn15/extra1 third_party2
-file:///C:/development/svn_example/repos/svn15/extra1@r1 third_party大介
-
-
-
diff --git a/setuptools/tests/svn_data/svn15_info.xml b/setuptools/tests/svn_data/svn15_info.xml
deleted file mode 100644
index 0b3550af..00000000
--- a/setuptools/tests/svn_data/svn15_info.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn15/main
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-normal
-infinity
-
-
-ptt
-2013-07-13T15:34:49.562500Z
-
-
-
-file:///C:/development/svn_example/repos/svn15/main/a%20file
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-normal
-infinity
-2013-07-13T15:34:43.109375Z
-a6166e5e98a5a503089cde9bc8031293
-
-
-ptt
-2013-07-13T15:34:43.484375Z
-
-
-
-file:///C:/development/svn_example/repos/svn15/main/to_delete
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-delete
-infinity
-2013-07-13T15:34:49.125000Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:34:49.562500Z
-
-
-
-file:///C:/development/svn_example/repos/svn15/main/folder
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-normal
-infinity
-
-
-ptt
-2013-07-13T15:34:47.515625Z
-
-
-
-file:///C:/development/svn_example/repos/svn15/main/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-normal
-infinity
-2013-07-13T15:34:42.109375Z
-795240c6a830c14f83961e57e07dad12
-
-
-ptt
-2013-07-13T15:34:42.484375Z
-
-
-
-file:///C:/development/svn_example/repos/svn15/main/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn15/main
-4eab6983-54fe-384b-a282-9306f52d948f
-
-
-normal
-infinity
-2013-07-13T15:34:41.375000Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:34:41.734375Z
-
-
-
diff --git a/setuptools/tests/svn_data/svn16_example.zip b/setuptools/tests/svn_data/svn16_example.zip
deleted file mode 100644
index e886b2af..00000000
Binary files a/setuptools/tests/svn_data/svn16_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn16_ext_list.txt b/setuptools/tests/svn_data/svn16_ext_list.txt
deleted file mode 100644
index 3ca54893..00000000
--- a/setuptools/tests/svn_data/svn16_ext_list.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-"third party3" file:///C:/development/svn_example/repos/svn16/extra1 
-'third party3b' file:///C:/development/svn_example/repos/svn16/extra1 
--r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party
diff --git a/setuptools/tests/svn_data/svn16_ext_list.xml b/setuptools/tests/svn_data/svn16_ext_list.xml
deleted file mode 100644
index 8ddaed0a..00000000
--- a/setuptools/tests/svn_data/svn16_ext_list.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn16/extra2 
--r3 file:///C:/development/svn_example/repos/svn16/extra2 third\ party2
-file:///C:/development/svn_example/repos/svn16/extra2@r1 third_party大介
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn16/extra1 
--r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
-
-
-
diff --git a/setuptools/tests/svn_data/svn16_info.xml b/setuptools/tests/svn_data/svn16_info.xml
deleted file mode 100644
index 745469c9..00000000
--- a/setuptools/tests/svn_data/svn16_info.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn16/main
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:17.390625Z
-
-
-
-file:///C:/development/svn_example/repos/svn16/main/a%20file
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-normal
-infinity
-2013-07-13T15:35:14.578125Z
-a6166e5e98a5a503089cde9bc8031293
-
-
-ptt
-2013-07-13T15:35:14.906250Z
-
-
-
-file:///C:/development/svn_example/repos/svn16/main/to_delete
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-delete
-infinity
-2013-07-13T15:35:17.046875Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:35:17.390625Z
-
-
-
-file:///C:/development/svn_example/repos/svn16/main/folder
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:16.406250Z
-
-
-
-file:///C:/development/svn_example/repos/svn16/main/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-normal
-infinity
-2013-07-13T15:35:14.078125Z
-795240c6a830c14f83961e57e07dad12
-
-
-ptt
-2013-07-13T15:35:14.421875Z
-
-
-
-file:///C:/development/svn_example/repos/svn16/main/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn16/main
-bd8d2cfc-1a74-de45-b166-262010c17c0a
-
-
-normal
-infinity
-2013-07-13T15:35:12.171875Z
-d41d8cd98f00b204e9800998ecf8427e
-
-
-ptt
-2013-07-13T15:35:13.906250Z
-
-
-
diff --git a/setuptools/tests/svn_data/svn17_example.zip b/setuptools/tests/svn_data/svn17_example.zip
deleted file mode 100644
index ba0e8823..00000000
Binary files a/setuptools/tests/svn_data/svn17_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn17_ext_list.txt b/setuptools/tests/svn_data/svn17_ext_list.txt
deleted file mode 100644
index a8b832a8..00000000
--- a/setuptools/tests/svn_data/svn17_ext_list.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-"third party3" file:///C:/development/svn_example/repos/svn17/extra1 
-'third party3b' file:///C:/development/svn_example/repos/svn17/extra1 
--r3 file:///C:/development/svn_example/repos/svn17/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn17/extra1@r1 third_party
diff --git a/setuptools/tests/svn_data/svn17_ext_list.xml b/setuptools/tests/svn_data/svn17_ext_list.xml
deleted file mode 100644
index 2879bb65..00000000
--- a/setuptools/tests/svn_data/svn17_ext_list.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn16/extra1 
--r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn17/extra2 
--r3 file:///C:/development/svn_example/repos/svn17/extra2 third\ party2
-file:///C:/development/svn_example/repos/svn17/extra2@r1 third_party大介
-
-
-
diff --git a/setuptools/tests/svn_data/svn17_info.xml b/setuptools/tests/svn_data/svn17_info.xml
deleted file mode 100644
index 6cffeffd..00000000
--- a/setuptools/tests/svn_data/svn17_info.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn17/main
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:36.171875Z
-
-
-
-file:///C:/development/svn_example/repos/svn17/main/folder
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:34.859375Z
-
-
-
-file:///C:/development/svn_example/repos/svn17/main/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-normal
-infinity
-2013-07-13T15:35:32.812500Z
-bc80eba9e7a10c0a571a4678c520bc9683f3bac2
-
-
-ptt
-2013-07-13T15:35:33.109375Z
-
-
-
-file:///C:/development/svn_example/repos/svn17/main/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-normal
-infinity
-2013-07-13T15:35:32.343750Z
-da39a3ee5e6b4b0d3255bfef95601890afd80709
-
-
-ptt
-2013-07-13T15:35:32.687500Z
-
-
-
-file:///C:/development/svn_example/repos/svn17/main/a%20file
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-normal
-infinity
-2013-07-13T15:35:33.187500Z
-43785ab4b1816b49f242990883292813cd4f486c
-
-
-ptt
-2013-07-13T15:35:33.515625Z
-
-
-
-file:///C:/development/svn_example/repos/svn17/main/to_delete
-
-file:///C:/development/svn_example/repos/svn17/main
-5ba45434-5197-164e-afab-81923f4744f5
-
-
-C:/development/svn_example/svn17_example
-delete
-infinity
-da39a3ee5e6b4b0d3255bfef95601890afd80709
-
-
-ptt
-2013-07-13T15:35:36.171875Z
-
-
-
diff --git a/setuptools/tests/svn_data/svn18_example.zip b/setuptools/tests/svn_data/svn18_example.zip
deleted file mode 100644
index 4362f8e9..00000000
Binary files a/setuptools/tests/svn_data/svn18_example.zip and /dev/null differ
diff --git a/setuptools/tests/svn_data/svn18_ext_list.txt b/setuptools/tests/svn_data/svn18_ext_list.txt
deleted file mode 100644
index c90a5f11..00000000
--- a/setuptools/tests/svn_data/svn18_ext_list.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-"third party3" file:///C:/development/svn_example/repos/svn18/extra1 
-'third party3b' file:///C:/development/svn_example/repos/svn18/extra1 
--r3 file:///C:/development/svn_example/repos/svn18/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn18/extra1@r1 third_party
diff --git a/setuptools/tests/svn_data/svn18_ext_list.xml b/setuptools/tests/svn_data/svn18_ext_list.xml
deleted file mode 100644
index 9b5e9e96..00000000
--- a/setuptools/tests/svn_data/svn18_ext_list.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn16/extra1 
--r3 file:///C:/development/svn_example/repos/svn16/extra1 third\ party2
-file:///C:/development/svn_example/repos/svn16/extra1@r1 third_party大介
-
-
-
-"third party3" file:///C:/development/svn_example/repos/svn18/extra2 
--r3 file:///C:/development/svn_example/repos/svn18/extra2 third\ party2
-file:///C:/development/svn_example/repos/svn18/extra2@r1 third_party大介
-
-
-
diff --git a/setuptools/tests/svn_data/svn18_info.xml b/setuptools/tests/svn_data/svn18_info.xml
deleted file mode 100644
index 7ca55995..00000000
--- a/setuptools/tests/svn_data/svn18_info.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-file:///C:/development/svn_example/repos/svn18/main
-^/
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:57.796875Z
-
-
-
-file:///C:/development/svn_example/repos/svn18/main/a%20file
-^/a%20file
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-normal
-infinity
-2013-07-13T15:35:54.906250Z
-43785ab4b1816b49f242990883292813cd4f486c
-
-
-ptt
-2013-07-13T15:35:55.265625Z
-
-
-
-file:///C:/development/svn_example/repos/svn18/main/to_delete
-^/to_delete
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-delete
-infinity
-da39a3ee5e6b4b0d3255bfef95601890afd80709
-
-
-ptt
-2013-07-13T15:35:57.796875Z
-
-
-
-file:///C:/development/svn_example/repos/svn18/main/folder
-^/folder
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-normal
-infinity
-
-
-ptt
-2013-07-13T15:35:56.750000Z
-
-
-
-file:///C:/development/svn_example/repos/svn18/main/folder/quest.txt
-^/folder/quest.txt
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-normal
-infinity
-2013-07-13T15:35:54.484375Z
-bc80eba9e7a10c0a571a4678c520bc9683f3bac2
-
-
-ptt
-2013-07-13T15:35:54.843750Z
-
-
-
-file:///C:/development/svn_example/repos/svn18/main/folder/lalala.txt
-^/folder/lalala.txt
-
-file:///C:/development/svn_example/repos/svn18/main
-3c5e3929-c92b-7045-9ba9-5e65d3dd1ee9
-
-
-C:/development/svn_example/svn18_example
-normal
-infinity
-2013-07-13T15:35:54.015625Z
-da39a3ee5e6b4b0d3255bfef95601890afd80709
-
-
-ptt
-2013-07-13T15:35:54.375000Z
-
-
-
-- 
cgit v1.2.1


From 4d121763d63948f4735249e7240b454a57b01159 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 25 Dec 2014 23:45:53 -0500
Subject: Bumped to 9.0 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 60a9e0b2..ecdc7c92 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.4'
+__version__ = '9.0'
-- 
cgit v1.2.1


From ec90f46ff647d73f0769d1d25259b21ae15c95b7 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 26 Dec 2014 13:44:04 -0500
Subject: Bumped to 8.5 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 60a9e0b2..dc4e8c6a 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.4'
+__version__ = '8.5'
-- 
cgit v1.2.1


From 8aa6480a1242aaa658d4bd521ff04efd1663a459 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 27 Dec 2014 11:07:39 -0500
Subject: Extract sandboxing context as a series of encapsulated contexts.

---
 setuptools/sandbox.py | 113 ++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 87 insertions(+), 26 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index e79a13a8..131b7048 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -5,6 +5,7 @@ import operator
 import functools
 import itertools
 import re
+import contextlib
 
 import pkg_resources
 
@@ -42,20 +43,95 @@ def _execfile(filename, globals, locals=None):
     code = compile(script, filename, 'exec')
     exec(code, globals, locals)
 
+
+@contextlib.contextmanager
+def save_argv():
+    saved = sys.argv[:]
+    try:
+        yield saved
+    finally:
+        sys.argv[:] = saved
+
+
+@contextlib.contextmanager
+def save_path():
+    saved = sys.path[:]
+    try:
+        yield saved
+    finally:
+        sys.path[:] = saved
+
+
+@contextlib.contextmanager
+def override_temp(replacement):
+    """
+    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
+    """
+    if not os.path.isdir(replacement):
+        os.makedirs(replacement)
+
+    saved = tempfile.tempdir
+
+    tempfile.tempdir = replacement
+
+    try:
+        yield
+    finally:
+        tempfile.tempdir = saved
+
+
+@contextlib.contextmanager
+def pushd(target):
+    saved = os.getcwd()
+    os.chdir(target)
+    try:
+        yield saved
+    finally:
+        os.chdir(saved)
+
+
+@contextlib.contextmanager
+def save_modules():
+    saved = sys.modules.copy()
+    try:
+        yield saved
+    finally:
+        sys.modules.update(saved)
+        # remove any modules imported since
+        del_modules = [
+            mod_name for mod_name in sys.modules
+            if mod_name not in saved
+            # exclude any encodings modules. See #285
+            and not mod_name.startswith('encodings.')
+        ]
+        list(map(sys.modules.__delitem__, del_modules))
+
+
+@contextlib.contextmanager
+def save_pkg_resources_state():
+    saved = pkg_resources.__getstate__()
+    try:
+        yield saved
+    finally:
+        pkg_resources.__setstate__(saved)
+
+
+@contextlib.contextmanager
+def setup_context(setup_dir):
+    temp_dir = os.path.join(setup_dir, 'temp')
+    with save_pkg_resources_state():
+        with save_modules():
+            with save_path():
+                with save_argv():
+                    with override_temp(temp_dir):
+                        with pushd(setup_dir):
+                            yield
+
+
 def run_setup(setup_script, args):
     """Run a distutils setup script, sandboxed in its directory"""
-    old_dir = os.getcwd()
-    save_argv = sys.argv[:]
-    save_path = sys.path[:]
     setup_dir = os.path.abspath(os.path.dirname(setup_script))
-    temp_dir = os.path.join(setup_dir,'temp')
-    if not os.path.isdir(temp_dir): os.makedirs(temp_dir)
-    save_tmp = tempfile.tempdir
-    save_modules = sys.modules.copy()
-    pr_state = pkg_resources.__getstate__()
-    try:
-        tempfile.tempdir = temp_dir
-        os.chdir(setup_dir)
+    with setup_context(setup_dir):
         try:
             sys.argv[:] = [setup_script]+list(args)
             sys.path.insert(0, setup_dir)
@@ -71,21 +147,6 @@ def run_setup(setup_script, args):
             if v.args and v.args[0]:
                 raise
             # Normal exit, just return
-    finally:
-        pkg_resources.__setstate__(pr_state)
-        sys.modules.update(save_modules)
-        # remove any modules imported within the sandbox
-        del_modules = [
-            mod_name for mod_name in sys.modules
-            if mod_name not in save_modules
-            # exclude any encodings modules. See #285
-            and not mod_name.startswith('encodings.')
-        ]
-        list(map(sys.modules.__delitem__, del_modules))
-        os.chdir(old_dir)
-        sys.path[:] = save_path
-        sys.argv[:] = save_argv
-        tempfile.tempdir = save_tmp
 
 
 class AbstractSandbox:
-- 
cgit v1.2.1


From 824cfa0bc32d500da6fd045147f752e8bf02f7b3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 15:39:46 -0500
Subject: Remove setuptools modules from sys.modules before invoking setup
 script. Fixes #315.

---
 setuptools/sandbox.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 131b7048..e958f912 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -121,6 +121,7 @@ def setup_context(setup_dir):
     temp_dir = os.path.join(setup_dir, 'temp')
     with save_pkg_resources_state():
         with save_modules():
+            hide_setuptools()
             with save_path():
                 with save_argv():
                     with override_temp(temp_dir):
@@ -128,6 +129,32 @@ def setup_context(setup_dir):
                             yield
 
 
+def _is_setuptools_module(mod_name):
+    """
+    >>> is_setuptools_module('setuptools')
+    True
+    >>> is_setuptools_module('pkg_resources')
+    True
+    >>> is_setuptools_module('setuptools_plugin')
+    False
+    >>> is_setuptools_module('setuptools.__init__')
+    True
+    """
+    pattern = re.compile('(setuptools|pkg_resources)(\.|$)')
+    return bool(pattern.match(mod_name))
+
+
+def hide_setuptools():
+    """
+    Remove references to setuptools' modules from sys.modules to allow the
+    invocation to import the most appropriate setuptools. This technique is
+    necessary to avoid issues such as #315 where setuptools upgrading itself
+    would fail to find a function declared in the metadata.
+    """
+    modules = list(filter(_is_setuptools_module, sys.modules))
+    list(map(sys.modules.__delitem__, modules))
+
+
 def run_setup(setup_script, args):
     """Run a distutils setup script, sandboxed in its directory"""
     setup_dir = os.path.abspath(os.path.dirname(setup_script))
-- 
cgit v1.2.1


From eb2fdc6f488d1a1d4b0cf02e9a8cf03ab33f9d23 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 15:42:40 -0500
Subject: Extract function for _clear_modules, encapsulating the need for the
 module names to be greedily evaluated before removing them.

---
 setuptools/sandbox.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index e958f912..f4f9dfec 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -98,13 +98,18 @@ def save_modules():
     finally:
         sys.modules.update(saved)
         # remove any modules imported since
-        del_modules = [
+        del_modules = (
             mod_name for mod_name in sys.modules
             if mod_name not in saved
             # exclude any encodings modules. See #285
             and not mod_name.startswith('encodings.')
-        ]
-        list(map(sys.modules.__delitem__, del_modules))
+        )
+        _clear_modules(del_modules)
+
+
+def _clear_modules(module_names):
+    for mod_name in list(module_names):
+        del sys.modules[mod_name]
 
 
 @contextlib.contextmanager
@@ -151,8 +156,8 @@ def hide_setuptools():
     necessary to avoid issues such as #315 where setuptools upgrading itself
     would fail to find a function declared in the metadata.
     """
-    modules = list(filter(_is_setuptools_module, sys.modules))
-    list(map(sys.modules.__delitem__, modules))
+    modules = filter(_is_setuptools_module, sys.modules)
+    _clear_modules(modules)
 
 
 def run_setup(setup_script, args):
-- 
cgit v1.2.1


From 15d7d87013e9c95f1e343ab7fee3d7f2bbd1d607 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 16:01:33 -0500
Subject: Include distutils in modules hidden

---
 setuptools/sandbox.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index f4f9dfec..2216e9a6 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -144,8 +144,10 @@ def _is_setuptools_module(mod_name):
     False
     >>> is_setuptools_module('setuptools.__init__')
     True
+    >>> is_setuptools_module('distutils')
+    True
     """
-    pattern = re.compile('(setuptools|pkg_resources)(\.|$)')
+    pattern = re.compile('(setuptools|pkg_resources|distutils)(\.|$)')
     return bool(pattern.match(mod_name))
 
 
-- 
cgit v1.2.1


From b239a5f2ec3ef076bfe825db1a694f02351b281f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 16:01:43 -0500
Subject: Correct docstring

---
 setuptools/sandbox.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 2216e9a6..63760df4 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -136,15 +136,15 @@ def setup_context(setup_dir):
 
 def _is_setuptools_module(mod_name):
     """
-    >>> is_setuptools_module('setuptools')
+    >>> _is_setuptools_module('setuptools')
     True
-    >>> is_setuptools_module('pkg_resources')
+    >>> _is_setuptools_module('pkg_resources')
     True
-    >>> is_setuptools_module('setuptools_plugin')
+    >>> _is_setuptools_module('setuptools_plugin')
     False
-    >>> is_setuptools_module('setuptools.__init__')
+    >>> _is_setuptools_module('setuptools.__init__')
     True
-    >>> is_setuptools_module('distutils')
+    >>> _is_setuptools_module('distutils')
     True
     """
     pattern = re.compile('(setuptools|pkg_resources|distutils)(\.|$)')
-- 
cgit v1.2.1


From ee14a898847efe9d53f7dc57b872805753463eb5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 16:02:14 -0500
Subject: Rename function to match intention.

---
 setuptools/sandbox.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 63760df4..f1b60cc0 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -134,17 +134,17 @@ def setup_context(setup_dir):
                             yield
 
 
-def _is_setuptools_module(mod_name):
+def _needs_hiding(mod_name):
     """
-    >>> _is_setuptools_module('setuptools')
+    >>> _needs_hiding('setuptools')
     True
-    >>> _is_setuptools_module('pkg_resources')
+    >>> _needs_hiding('pkg_resources')
     True
-    >>> _is_setuptools_module('setuptools_plugin')
+    >>> _needs_hiding('setuptools_plugin')
     False
-    >>> _is_setuptools_module('setuptools.__init__')
+    >>> _needs_hiding('setuptools.__init__')
     True
-    >>> _is_setuptools_module('distutils')
+    >>> _needs_hiding('distutils')
     True
     """
     pattern = re.compile('(setuptools|pkg_resources|distutils)(\.|$)')
@@ -158,7 +158,7 @@ def hide_setuptools():
     necessary to avoid issues such as #315 where setuptools upgrading itself
     would fail to find a function declared in the metadata.
     """
-    modules = filter(_is_setuptools_module, sys.modules)
+    modules = filter(_needs_hiding, sys.modules)
     _clear_modules(modules)
 
 
-- 
cgit v1.2.1


From 22715bcc472ac5b41cfcd94fa7ca26a5cef01eb9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 20:54:46 -0500
Subject: Disable purging of distutils/setuptools during sandbox operations.
 Ref #315.

---
 setuptools/sandbox.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index f1b60cc0..e3c18e39 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -126,7 +126,9 @@ def setup_context(setup_dir):
     temp_dir = os.path.join(setup_dir, 'temp')
     with save_pkg_resources_state():
         with save_modules():
-            hide_setuptools()
+            # Disabled per
+            # https://bitbucket.org/pypa/setuptools/issue/315/setuptools-should-always-use-its-own#comment-14512075
+            # hide_setuptools()
             with save_path():
                 with save_argv():
                     with override_temp(temp_dir):
-- 
cgit v1.2.1


From d01f1071facee9aecbf8e4c298b0ada9e2a86ff3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 20:57:13 -0500
Subject: Bumped to 9.0 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index dc4e8c6a..ecdc7c92 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '8.5'
+__version__ = '9.0'
-- 
cgit v1.2.1


From eba2f2e7cd3b4f6c83e20eb796dd4605135f25fb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 28 Dec 2014 20:58:04 -0500
Subject: Bumped to 9.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index ecdc7c92..0c9cd65d 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.0'
+__version__ = '9.1'
-- 
cgit v1.2.1


From fedce94aa39dc453dbab5b644e9d7a1904e1e838 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 09:47:38 -0500
Subject: Bumped to 9.0.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 0c9cd65d..c81459c6 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.1'
+__version__ = '9.0.1'
-- 
cgit v1.2.1


From 2f970dc0ee4d4cef77d12901108944ae157391a4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 09:48:10 -0500
Subject: Bumped to 9.0.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index c81459c6..51b5923d 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.0.1'
+__version__ = '9.0.2'
-- 
cgit v1.2.1


From a87a4245eca468d09b69ca078f7105c38e03405b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 13:15:00 -0500
Subject: Bumped to 9.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 51b5923d..0c9cd65d 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.0.2'
+__version__ = '9.1'
-- 
cgit v1.2.1


From cd8a46e3c9f604bc2bd1ba769854cfa73f905d28 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 13:15:31 -0500
Subject: Bumped to 9.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 0c9cd65d..465f8ef8 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.1'
+__version__ = '9.2'
-- 
cgit v1.2.1


From 01ca6210955b4a0fcb1e887d7b156c923e5d3eff Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 13:17:00 -0500
Subject: Remove unused import

---
 setuptools/tests/test_easy_install.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index a4430953..3659d53f 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -23,7 +23,6 @@ from pkg_resources import working_set, VersionConflict
 from pkg_resources import Distribution as PRDistribution
 import setuptools.tests.server
 import pkg_resources
-from .py26compat import skipIf
 
 class FakeDist(object):
     def get_entry_map(self, group):
-- 
cgit v1.2.1


From 02b5adcc7ff26f6eaf024ec46f22b0c26c8f9c0b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 13:37:08 -0500
Subject: Remove duplicate import

---
 setuptools/tests/__init__.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index 48b29c4c..e5d6545a 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -11,7 +11,6 @@ from distutils.core import Extension
 from distutils.version import LooseVersion
 from setuptools.compat import func_code
 
-from setuptools.compat import func_code
 import setuptools.dist
 import setuptools.depends as dep
 from setuptools import Feature
-- 
cgit v1.2.1


From 42d0bc2269e6a1ddfb056e70b95712ad31401c89 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 14:06:05 -0500
Subject: Rename variable for clarity.

---
 setuptools/tests/test_easy_install.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 3659d53f..6358c934 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -435,10 +435,10 @@ def reset_setup_stop_context():
     within those tests, it's necessary to reset the global variable
     in distutils.core so that the setup() command will run naturally.
     """
-    setup_stop_after = distutils.core._setup_stop_after
+    saved = distutils.core._setup_stop_after
     distutils.core._setup_stop_after = None
     yield
-    distutils.core._setup_stop_after = setup_stop_after
+    distutils.core._setup_stop_after = saved
 
 
 @contextlib.contextmanager
-- 
cgit v1.2.1


From 4a7ea62f3efc4297bcc8c2a8094fa687474fb5f1 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 14:06:26 -0500
Subject: Reindent using textwrap

---
 setuptools/command/easy_install.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index a71a7f36..d368e1a3 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -2121,10 +2121,10 @@ def main(argv=None, **kw):
     from setuptools.dist import Distribution
     import distutils.core
 
-    USAGE = """\
-usage: %(script)s [options] requirement_or_url ...
-   or: %(script)s --help
-"""
+    USAGE = textwrap.dedent("""
+        usage: %(script)s [options] requirement_or_url ...
+           or: %(script)s --help
+        """).lstrip()
 
     def gen_usage(script_name):
         return USAGE % dict(
-- 
cgit v1.2.1


From 8826a85c8c2dd4b3b5080de725486b0b30e79e4f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 14:29:09 -0500
Subject: Extract _patch_usage and re-implement as a context manager.

---
 setuptools/command/easy_install.py | 50 ++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index d368e1a3..125ceba2 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -34,6 +34,7 @@ import textwrap
 import warnings
 import site
 import struct
+import contextlib
 
 from setuptools import Command
 from setuptools.sandbox import run_setup
@@ -2119,39 +2120,42 @@ def bootstrap():
 def main(argv=None, **kw):
     from setuptools import setup
     from setuptools.dist import Distribution
-    import distutils.core
-
-    USAGE = textwrap.dedent("""
-        usage: %(script)s [options] requirement_or_url ...
-           or: %(script)s --help
-        """).lstrip()
-
-    def gen_usage(script_name):
-        return USAGE % dict(
-            script=os.path.basename(script_name),
-        )
-
-    def with_ei_usage(f):
-        old_gen_usage = distutils.core.gen_usage
-        try:
-            distutils.core.gen_usage = gen_usage
-            return f()
-        finally:
-            distutils.core.gen_usage = old_gen_usage
 
     class DistributionWithoutHelpCommands(Distribution):
         common_usage = ""
 
         def _show_help(self, *args, **kw):
-            with_ei_usage(lambda: Distribution._show_help(self, *args, **kw))
+            with _patch_usage():
+                Distribution._show_help(self, *args, **kw)
 
     if argv is None:
         argv = sys.argv[1:]
 
-    with_ei_usage(
-        lambda: setup(
+    with _patch_usage():
+        setup(
             script_args=['-q', 'easy_install', '-v'] + argv,
             script_name=sys.argv[0] or 'easy_install',
             distclass=DistributionWithoutHelpCommands, **kw
         )
-    )
+
+
+@contextlib.contextmanager
+def _patch_usage():
+    import distutils.core
+    USAGE = textwrap.dedent("""
+        usage: %(script)s [options] requirement_or_url ...
+           or: %(script)s --help
+        """).lstrip()
+
+    def gen_usage(script_name):
+        return USAGE % dict(
+            script=os.path.basename(script_name),
+        )
+
+    saved = distutils.core.gen_usage
+    distutils.core.gen_usage = gen_usage
+    try:
+        yield
+    finally:
+        distutils.core.gen_usage = saved
+
-- 
cgit v1.2.1


From 195076859f1716ec22ea08dc1b29de47fca7af0c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 14:39:00 -0500
Subject: Remove unused import

---
 setuptools/__init__.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index ca025c30..8188f125 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -1,7 +1,6 @@
 """Extensions to the 'distutils' for large or complex distributions"""
 
 import os
-import sys
 import distutils.core
 import distutils.filelist
 from distutils.core import Command as _Command
-- 
cgit v1.2.1


From 80561b7f0bb7cf8488e342ee853ac9aff107b021 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 14:49:47 -0500
Subject: Use pytest to capture exception

---
 setuptools/tests/test_easy_install.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 6358c934..530f89f3 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -12,6 +12,8 @@ import tarfile
 import logging
 import distutils.core
 
+import pytest
+
 from setuptools.compat import StringIO, BytesIO, urlparse
 from setuptools.sandbox import run_setup, SandboxViolation
 from setuptools.command.easy_install import (
@@ -278,8 +280,8 @@ class TestSetupRequires(unittest.TestCase):
                             with argv_context(['easy_install']):
                                 # attempt to install the dist. It should fail because
                                 #  it doesn't exist.
-                                self.assertRaises(SystemExit,
-                                    easy_install_pkg.main, ei_params)
+                                with pytest.raises(SystemExit):
+                                    easy_install_pkg.main(ei_params)
         # there should have been two or three requests to the server
         #  (three happens on Python 3.3a)
         self.assertTrue(2 <= len(p_index.requests) <= 3)
-- 
cgit v1.2.1


From 1e6095429693886831747050b38bad979eaaf966 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 22:17:26 -0500
Subject: Backed out changeset: 40cc1fbecb1c Restores purging of
 distutils/setuptools during sandbox operations. Ref #315.

---
 setuptools/sandbox.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index e3c18e39..f1b60cc0 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -126,9 +126,7 @@ def setup_context(setup_dir):
     temp_dir = os.path.join(setup_dir, 'temp')
     with save_pkg_resources_state():
         with save_modules():
-            # Disabled per
-            # https://bitbucket.org/pypa/setuptools/issue/315/setuptools-should-always-use-its-own#comment-14512075
-            # hide_setuptools()
+            hide_setuptools()
             with save_path():
                 with save_argv():
                     with override_temp(temp_dir):
-- 
cgit v1.2.1


From 12169497ccb2303474016e01933f52d7e4eab93a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 22:48:19 -0500
Subject: Catch, save, and restore any exceptions across the save_modules
 context. This corrects the latter of the two test failures. Ref #315.

---
 setuptools/sandbox.py | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index f1b60cc0..c6840ce4 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -6,6 +6,7 @@ import functools
 import itertools
 import re
 import contextlib
+import pickle
 
 import pkg_resources
 
@@ -21,6 +22,7 @@ _open = open
 from distutils.errors import DistutilsError
 from pkg_resources import working_set
 
+from setuptools import compat
 from setuptools.compat import builtins
 
 __all__ = [
@@ -92,19 +94,38 @@ def pushd(target):
 
 @contextlib.contextmanager
 def save_modules():
+    """
+    Context in which imported modules are saved.
+
+    Translates exceptions internal to the context into the equivalent exception
+    outside the context.
+    """
     saved = sys.modules.copy()
     try:
-        yield saved
-    finally:
-        sys.modules.update(saved)
-        # remove any modules imported since
-        del_modules = (
-            mod_name for mod_name in sys.modules
-            if mod_name not in saved
-            # exclude any encodings modules. See #285
-            and not mod_name.startswith('encodings.')
-        )
-        _clear_modules(del_modules)
+        try:
+            yield saved
+        except:
+            # dump any exception
+            class_, exc, tb = sys.exc_info()
+            saved_cls = pickle.dumps(class_)
+            saved_exc = pickle.dumps(exc)
+            raise
+        finally:
+            sys.modules.update(saved)
+            # remove any modules imported since
+            del_modules = (
+                mod_name for mod_name in sys.modules
+                if mod_name not in saved
+                # exclude any encodings modules. See #285
+                and not mod_name.startswith('encodings.')
+            )
+            _clear_modules(del_modules)
+    except:
+        # reload and re-raise any exception, using restored modules
+        class_, exc, tb = sys.exc_info()
+        new_cls = pickle.loads(saved_cls)
+        new_exc = pickle.loads(saved_exc)
+        compat.reraise(new_cls, new_exc, tb)
 
 
 def _clear_modules(module_names):
-- 
cgit v1.2.1


From dce270b4271ad6607c28103c9199303121b52015 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 23:40:30 -0500
Subject: Make sure to monkey-patch the easy_install module in the setup
 context. Fixes the other former test failure. Ref #315.

---
 setuptools/tests/test_easy_install.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 530f89f3..546fa750 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -13,7 +13,9 @@ import logging
 import distutils.core
 
 import pytest
+import mock
 
+from setuptools import sandbox
 from setuptools.compat import StringIO, BytesIO, urlparse
 from setuptools.sandbox import run_setup, SandboxViolation
 from setuptools.command.easy_install import (
@@ -227,6 +229,27 @@ class TestUserInstallTest(unittest.TestCase):
             else:
                 del os.environ['PYTHONPATH']
 
+    @contextlib.contextmanager
+    def user_install_setup_context(self, *args, **kwargs):
+        """
+        Wrap sandbox.setup_context to patch easy_install in that context to
+        appear as user-installed.
+        """
+        with self.orig_context(*args, **kwargs):
+            import setuptools.command.easy_install as ei
+            ei.__file__ = site.USER_SITE
+            yield
+
+
+    def patched_setup_context(self):
+        self.orig_context = sandbox.setup_context
+
+        return mock.patch(
+            'setuptools.sandbox.setup_context',
+            self.user_install_setup_context,
+        )
+
+
     def test_setup_requires(self):
         """Regression test for Distribute issue #318
 
@@ -241,6 +264,7 @@ class TestUserInstallTest(unittest.TestCase):
         try:
             with quiet_context():
                 with reset_setup_stop_context():
+                  with self.patched_setup_context():
                     run_setup(test_setup_py, ['install'])
         except SandboxViolation:
             self.fail('Installation caused SandboxViolation')
-- 
cgit v1.2.1


From 457b0161e28614dec6b6ff0f1dbbc090d9e0c597 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 29 Dec 2014 23:41:03 -0500
Subject: Reindent

---
 setuptools/tests/test_easy_install.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 546fa750..38a49bf7 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -264,8 +264,8 @@ class TestUserInstallTest(unittest.TestCase):
         try:
             with quiet_context():
                 with reset_setup_stop_context():
-                  with self.patched_setup_context():
-                    run_setup(test_setup_py, ['install'])
+                    with self.patched_setup_context():
+                        run_setup(test_setup_py, ['install'])
         except SandboxViolation:
             self.fail('Installation caused SandboxViolation')
         except IndexError:
-- 
cgit v1.2.1


From dbab8ae868d8b15d7082ee19bbd577140dea9652 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 09:26:59 -0500
Subject: Indent script for clarity

---
 setuptools/tests/test_easy_install.py | 36 +++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 530f89f3..bb6b7fc5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -35,24 +35,24 @@ class FakeDist(object):
     def as_requirement(self):
         return 'spec'
 
-WANTED = """\
-#!%s
-# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
-__requires__ = 'spec'
-import sys
-from pkg_resources import load_entry_point
-
-if __name__ == '__main__':
-    sys.exit(
-        load_entry_point('spec', 'console_scripts', 'name')()
-    )
-""" % nt_quote_arg(fix_jython_executable(sys.executable, ""))
-
-SETUP_PY = """\
-from setuptools import setup
-
-setup(name='foo')
-"""
+WANTED = textwrap.dedent("""
+    #!%s
+    # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
+    __requires__ = 'spec'
+    import sys
+    from pkg_resources import load_entry_point
+
+    if __name__ == '__main__':
+        sys.exit(
+            load_entry_point('spec', 'console_scripts', 'name')()
+        )
+    """).lstrip() % nt_quote_arg(fix_jython_executable(sys.executable, ""))
+
+SETUP_PY = textwrap.dedent("""
+    from setuptools import setup
+
+    setup(name='foo')
+    """).lstrip()
 
 class TestEasyInstallTest(unittest.TestCase):
 
-- 
cgit v1.2.1


From 10197f6d76a56d358236ceb35435d3789d0fd2b0 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 09:45:51 -0500
Subject: Extract variable for clarity of reading

---
 setuptools/command/easy_install.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 125ceba2..1a2f56ae 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1549,10 +1549,14 @@ class PthDistributions(Environment):
 
     def add(self, dist):
         """Add `dist` to the distribution map"""
-        if (dist.location not in self.paths and (
-            dist.location not in self.sitedirs or
-            dist.location == os.getcwd()  # account for '.' being in PYTHONPATH
-        )):
+        new_path = (
+            dist.location not in self.paths and (
+                dist.location not in self.sitedirs or
+                # account for '.' being in PYTHONPATH
+                dist.location == os.getcwd()
+            )
+        )
+        if new_path:
             self.paths.append(dist.location)
             self.dirty = True
         Environment.add(self, dist)
-- 
cgit v1.2.1


From 292d4db0eb5c7591eed972ed9085362167816de0 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 09:48:55 -0500
Subject: Rewrite test to remove Windows-specific handling and instead capture
 the underlying expectation.

---
 setuptools/tests/test_easy_install.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index bb6b7fc5..a8f274d5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -114,10 +114,9 @@ class TestPTHFileWriter(unittest.TestCase):
         self.assertTrue(pth.dirty)
 
     def test_add_from_site_is_ignored(self):
-        if os.name != 'nt':
-            location = '/test/location/does-not-have-to-exist'
-        else:
-            location = 'c:\\does_not_exist'
+        location = '/test/location/does-not-have-to-exist'
+        # PthDistributions expects all locations to be normalized
+        location = pkg_resources.normalize_path(location)
         pth = PthDistributions('does-not_exist', [location, ])
         self.assertTrue(not pth.dirty)
         pth.add(PRDistribution(location))
-- 
cgit v1.2.1


From 470028e10ea01e57ece6df3c953a309e0017d068 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 09:51:57 -0500
Subject: Rewrite file operations using context managers.

---
 setuptools/tests/test_easy_install.py | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index a8f274d5..0bb4c22f 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -128,9 +128,8 @@ class TestUserInstallTest(unittest.TestCase):
     def setUp(self):
         self.dir = tempfile.mkdtemp()
         setup = os.path.join(self.dir, 'setup.py')
-        f = open(setup, 'w')
-        f.write(SETUP_PY)
-        f.close()
+        with open(setup, 'w') as f:
+            f.write(SETUP_PY)
         self.old_cwd = os.getcwd()
         os.chdir(self.dir)
 
@@ -191,11 +190,8 @@ class TestUserInstallTest(unittest.TestCase):
         new_location = tempfile.mkdtemp()
         target = tempfile.mkdtemp()
         egg_file = os.path.join(new_location, 'foo-1.0.egg-info')
-        f = open(egg_file, 'w')
-        try:
+        with open(egg_file, 'w') as f:
             f.write('Name: foo\n')
-        finally:
-            f.close()
 
         sys.path.append(target)
         old_ppath = os.environ.get('PYTHONPATH')
@@ -358,12 +354,11 @@ def create_setup_requires_package(path):
     test_setup_py = os.path.join(test_pkg, 'setup.py')
     os.mkdir(test_pkg)
 
-    f = open(test_setup_py, 'w')
-    f.write(textwrap.dedent("""\
-        import setuptools
-        setuptools.setup(**%r)
-    """ % test_setup_attrs))
-    f.close()
+    with open(test_setup_py, 'w') as f:
+        f.write(textwrap.dedent("""\
+            import setuptools
+            setuptools.setup(**%r)
+        """ % test_setup_attrs))
 
     foobar_path = os.path.join(path, 'foobar-0.1.tar.gz')
     make_trivial_sdist(
@@ -392,11 +387,8 @@ def make_trivial_sdist(dist_path, setup_py):
         MemFile = StringIO
     setup_py_bytes = MemFile(setup_py.encode('utf-8'))
     setup_py_file.size = len(setup_py_bytes.getvalue())
-    dist = tarfile.open(dist_path, 'w:gz')
-    try:
+    with tarfile.open(dist_path, 'w:gz') as dist:
         dist.addfile(setup_py_file, fileobj=setup_py_bytes)
-    finally:
-        dist.close()
 
 
 @contextlib.contextmanager
-- 
cgit v1.2.1


From 7794b1b0348f2cb76317b40a5ec7931527501c94 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:01:23 -0500
Subject: Add compatibility shim for tarfile.open

---
 setuptools/tests/py26compat.py        | 12 ++++++++++++
 setuptools/tests/test_easy_install.py |  4 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index d4fb891a..24e6dbe2 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -1,4 +1,6 @@
+import sys
 import unittest
+import tarfile
 
 try:
 	# provide skipIf for Python 2.4-2.6
@@ -12,3 +14,13 @@ except AttributeError:
 				return skip
 			return func
 		return skipper
+
+def _tarfile_open_ex(*args, **kwargs):
+	"""
+	Extend result with an __exit__ to close the file.
+	"""
+	res = tarfile.open(*args, **kwargs)
+	res.__exit__ = lambda self: self.close()
+	return res
+
+tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else  tarfile.open
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 0bb4c22f..1abb82fd 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -26,6 +26,8 @@ from pkg_resources import Distribution as PRDistribution
 import setuptools.tests.server
 import pkg_resources
 
+from .py26compat import tarfile_open
+
 class FakeDist(object):
     def get_entry_map(self, group):
         if group != 'console_scripts':
@@ -387,7 +389,7 @@ def make_trivial_sdist(dist_path, setup_py):
         MemFile = StringIO
     setup_py_bytes = MemFile(setup_py.encode('utf-8'))
     setup_py_file.size = len(setup_py_bytes.getvalue())
-    with tarfile.open(dist_path, 'w:gz') as dist:
+    with tarfile_open(dist_path, 'w:gz') as dist:
         dist.addfile(setup_py_file, fileobj=setup_py_bytes)
 
 
-- 
cgit v1.2.1


From cd4aab1dff5f40aeaa08174a05f15527f67f66d4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:04:27 -0500
Subject: Include __enter__ in shim

---
 setuptools/tests/py26compat.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index 24e6dbe2..ead72fa6 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -17,10 +17,11 @@ except AttributeError:
 
 def _tarfile_open_ex(*args, **kwargs):
 	"""
-	Extend result with an __exit__ to close the file.
+	Extend result as a context manager.
 	"""
 	res = tarfile.open(*args, **kwargs)
 	res.__exit__ = lambda self: self.close()
+	res.__enter__ = lambda self: self
 	return res
 
 tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else  tarfile.open
-- 
cgit v1.2.1


From 271734598e6c9fc50b4809ee223cc3281d54615c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:12:57 -0500
Subject: Try without self, as methods are set on the instance. Also include
 parameters to __exit__.

---
 setuptools/tests/py26compat.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index ead72fa6..efe2f956 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -20,8 +20,9 @@ def _tarfile_open_ex(*args, **kwargs):
 	Extend result as a context manager.
 	"""
 	res = tarfile.open(*args, **kwargs)
-	res.__exit__ = lambda self: self.close()
-	res.__enter__ = lambda self: self
+	res.__exit__ = lambda exc_type, exc_value, traceback: self.close()
+	res.__enter__ = lambda: res
 	return res
 
-tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else  tarfile.open
+tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open
+tarfile_open = _tarfile_open_ex
-- 
cgit v1.2.1


From f678f5c1a197c504ae6703f3b4e5658f9e2db1f6 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:15:45 -0500
Subject: Remove spurious reference to self. Remove debugging code.

---
 setuptools/tests/py26compat.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index efe2f956..e120e744 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -20,9 +20,8 @@ def _tarfile_open_ex(*args, **kwargs):
 	Extend result as a context manager.
 	"""
 	res = tarfile.open(*args, **kwargs)
-	res.__exit__ = lambda exc_type, exc_value, traceback: self.close()
+	res.__exit__ = lambda exc_type, exc_value, traceback: res.close()
 	res.__enter__ = lambda: res
 	return res
 
 tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open
-tarfile_open = _tarfile_open_ex
-- 
cgit v1.2.1


From de1af740bc79592faac63b3c0c8d50383b373dd4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:20:30 -0500
Subject: Extract common operation of dedent and left strip

---
 setuptools/tests/test_easy_install.py | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 1abb82fd..d915f3c5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -28,6 +28,14 @@ import pkg_resources
 
 from .py26compat import tarfile_open
 
+
+def DALS(input):
+    """
+    Dedent and left-strip
+    """
+    return textwrap.dedent(input).lstrip()
+
+
 class FakeDist(object):
     def get_entry_map(self, group):
         if group != 'console_scripts':
@@ -37,7 +45,7 @@ class FakeDist(object):
     def as_requirement(self):
         return 'spec'
 
-WANTED = textwrap.dedent("""
+WANTED = DALS("""
     #!%s
     # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
     __requires__ = 'spec'
@@ -48,13 +56,13 @@ WANTED = textwrap.dedent("""
         sys.exit(
             load_entry_point('spec', 'console_scripts', 'name')()
         )
-    """).lstrip() % nt_quote_arg(fix_jython_executable(sys.executable, ""))
+    """) % nt_quote_arg(fix_jython_executable(sys.executable, ""))
 
-SETUP_PY = textwrap.dedent("""
+SETUP_PY = DALS("""
     from setuptools import setup
 
     setup(name='foo')
-    """).lstrip()
+    """)
 
 class TestEasyInstallTest(unittest.TestCase):
 
@@ -295,14 +303,14 @@ class TestSetupRequires(unittest.TestCase):
             dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
             make_trivial_sdist(
                 dist_path,
-                textwrap.dedent("""
+                DALS("""
                     import setuptools
                     setuptools.setup(
                         name="setuptools-test-fetcher",
                         version="1.0",
                         setup_requires = ['does-not-exist'],
                     )
-                """).lstrip())
+                """))
             yield dist_path
 
     def test_setup_requires_overrides_version_conflict(self):
@@ -357,7 +365,7 @@ def create_setup_requires_package(path):
     os.mkdir(test_pkg)
 
     with open(test_setup_py, 'w') as f:
-        f.write(textwrap.dedent("""\
+        f.write(DALS("""
             import setuptools
             setuptools.setup(**%r)
         """ % test_setup_attrs))
@@ -365,7 +373,7 @@ def create_setup_requires_package(path):
     foobar_path = os.path.join(path, 'foobar-0.1.tar.gz')
     make_trivial_sdist(
         foobar_path,
-        textwrap.dedent("""\
+        DALS("""
             import setuptools
             setuptools.setup(
                 name='foobar',
-- 
cgit v1.2.1


From 1a0233012a7a800bf585f739c4121e2ee830436d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:21:10 -0500
Subject: Extract script variable for clarity

---
 setuptools/tests/test_easy_install.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index d915f3c5..05063331 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -301,16 +301,18 @@ class TestSetupRequires(unittest.TestCase):
         """
         with tempdir_context() as dir:
             dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
-            make_trivial_sdist(
-                dist_path,
-                DALS("""
+            script = DALS("""
                     import setuptools
                     setuptools.setup(
                         name="setuptools-test-fetcher",
                         version="1.0",
                         setup_requires = ['does-not-exist'],
                     )
-                """))
+                """)
+            make_trivial_sdist(
+                dist_path,
+                script,
+            )
             yield dist_path
 
     def test_setup_requires_overrides_version_conflict(self):
-- 
cgit v1.2.1


From ef6b79453e26811eb387a8252834bf1f990f2a8d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:21:39 -0500
Subject: Reindent

---
 setuptools/tests/test_easy_install.py | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 05063331..4ee5adbe 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -302,17 +302,14 @@ class TestSetupRequires(unittest.TestCase):
         with tempdir_context() as dir:
             dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
             script = DALS("""
-                    import setuptools
-                    setuptools.setup(
-                        name="setuptools-test-fetcher",
-                        version="1.0",
-                        setup_requires = ['does-not-exist'],
-                    )
+                import setuptools
+                setuptools.setup(
+                    name="setuptools-test-fetcher",
+                    version="1.0",
+                    setup_requires = ['does-not-exist'],
+                )
                 """)
-            make_trivial_sdist(
-                dist_path,
-                script,
-            )
+            make_trivial_sdist(dist_path, script)
             yield dist_path
 
     def test_setup_requires_overrides_version_conflict(self):
-- 
cgit v1.2.1


From bf03c647971da1e3c5b69626fecf7f7be2830043 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:25:49 -0500
Subject: reset_setup_stop_context is apparently no longer needed.

---
 setuptools/tests/test_easy_install.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 4ee5adbe..dd1655d3 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -245,7 +245,6 @@ class TestUserInstallTest(unittest.TestCase):
 
         try:
             with quiet_context():
-                with reset_setup_stop_context():
                     run_setup(test_setup_py, ['install'])
         except SandboxViolation:
             self.fail('Installation caused SandboxViolation')
@@ -281,8 +280,7 @@ class TestSetupRequires(unittest.TestCase):
                             '--allow-hosts', p_index_loc,
                             '--exclude-scripts', '--install-dir', temp_install_dir,
                             dist_file]
-                        with reset_setup_stop_context():
-                            with argv_context(['easy_install']):
+                        with argv_context(['easy_install']):
                                 # attempt to install the dist. It should fail because
                                 #  it doesn't exist.
                                 with pytest.raises(SystemExit):
@@ -331,7 +329,6 @@ class TestSetupRequires(unittest.TestCase):
                 test_pkg = create_setup_requires_package(temp_dir)
                 test_setup_py = os.path.join(test_pkg, 'setup.py')
                 with quiet_context() as (stdout, stderr):
-                    with reset_setup_stop_context():
                         try:
                             # Don't even need to install the package, just
                             # running the setup.py at all is sufficient
@@ -438,6 +435,8 @@ def reset_setup_stop_context():
     in distutils.core so that the setup() command will run naturally.
     """
     saved = distutils.core._setup_stop_after
+    if saved is None:
+        raise ValueError("Not Needed")
     distutils.core._setup_stop_after = None
     yield
     distutils.core._setup_stop_after = saved
-- 
cgit v1.2.1


From f3d7a63e56f7d0ba768a10a2787e25679869922f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:26:45 -0500
Subject: Remove reset_setup_stop_context and reindent.

---
 setuptools/tests/test_easy_install.py | 39 +++++++++++------------------------
 1 file changed, 12 insertions(+), 27 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index dd1655d3..4ca659d5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -245,7 +245,7 @@ class TestUserInstallTest(unittest.TestCase):
 
         try:
             with quiet_context():
-                    run_setup(test_setup_py, ['install'])
+                run_setup(test_setup_py, ['install'])
         except SandboxViolation:
             self.fail('Installation caused SandboxViolation')
         except IndexError:
@@ -281,10 +281,10 @@ class TestSetupRequires(unittest.TestCase):
                             '--exclude-scripts', '--install-dir', temp_install_dir,
                             dist_file]
                         with argv_context(['easy_install']):
-                                # attempt to install the dist. It should fail because
-                                #  it doesn't exist.
-                                with pytest.raises(SystemExit):
-                                    easy_install_pkg.main(ei_params)
+                            # attempt to install the dist. It should fail because
+                            #  it doesn't exist.
+                            with pytest.raises(SystemExit):
+                                easy_install_pkg.main(ei_params)
         # there should have been two or three requests to the server
         #  (three happens on Python 3.3a)
         self.assertTrue(2 <= len(p_index.requests) <= 3)
@@ -329,13 +329,13 @@ class TestSetupRequires(unittest.TestCase):
                 test_pkg = create_setup_requires_package(temp_dir)
                 test_setup_py = os.path.join(test_pkg, 'setup.py')
                 with quiet_context() as (stdout, stderr):
-                        try:
-                            # Don't even need to install the package, just
-                            # running the setup.py at all is sufficient
-                            run_setup(test_setup_py, ['--name'])
-                        except VersionConflict:
-                            self.fail('Installing setup.py requirements '
-                                'caused a VersionConflict')
+                    try:
+                        # Don't even need to install the package, just
+                        # running the setup.py at all is sufficient
+                        run_setup(test_setup_py, ['--name'])
+                    except VersionConflict:
+                        self.fail('Installing setup.py requirements '
+                            'caused a VersionConflict')
 
                 lines = stdout.readlines()
                 self.assertTrue(len(lines) > 0)
@@ -426,21 +426,6 @@ def argv_context(repl):
     yield
     sys.argv[:] = old_argv
 
-@contextlib.contextmanager
-def reset_setup_stop_context():
-    """
-    When the setuptools tests are run using setup.py test, and then
-    one wants to invoke another setup() command (such as easy_install)
-    within those tests, it's necessary to reset the global variable
-    in distutils.core so that the setup() command will run naturally.
-    """
-    saved = distutils.core._setup_stop_after
-    if saved is None:
-        raise ValueError("Not Needed")
-    distutils.core._setup_stop_after = None
-    yield
-    distutils.core._setup_stop_after = saved
-
 
 @contextlib.contextmanager
 def quiet_context():
-- 
cgit v1.2.1


From e3a4428d6a4e3889992ebb1765f27d9b9807325b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:28:40 -0500
Subject: Remove unused import

---
 setuptools/tests/test_easy_install.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 4ca659d5..d4d29e27 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -10,7 +10,6 @@ import contextlib
 import textwrap
 import tarfile
 import logging
-import distutils.core
 
 import pytest
 
-- 
cgit v1.2.1


From c2948e8c76a2778371b779d56682ec61d48dfbc3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:30:42 -0500
Subject: Reindent for clarity

---
 setuptools/tests/test_easy_install.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index d4d29e27..ca943948 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -275,10 +275,13 @@ class TestSetupRequires(unittest.TestCase):
             with TestSetupRequires.create_sdist() as dist_file:
                 with tempdir_context() as temp_install_dir:
                     with environment_context(PYTHONPATH=temp_install_dir):
-                        ei_params = ['--index-url', p_index.url,
+                        ei_params = [
+                            '--index-url', p_index.url,
                             '--allow-hosts', p_index_loc,
-                            '--exclude-scripts', '--install-dir', temp_install_dir,
-                            dist_file]
+                            '--exclude-scripts',
+                            '--install-dir', temp_install_dir,
+                            dist_file,
+                        ]
                         with argv_context(['easy_install']):
                             # attempt to install the dist. It should fail because
                             #  it doesn't exist.
-- 
cgit v1.2.1


From 2376cb11cd1383622c97e52006ccabf12c78fffe Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:37:52 -0500
Subject: Slice the iterable rather than converting to a list and slicing that.

---
 setuptools/tests/test_easy_install.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index ca943948..053b6971 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -10,6 +10,7 @@ import contextlib
 import textwrap
 import tarfile
 import logging
+import itertools
 
 import pytest
 
@@ -82,7 +83,8 @@ class TestEasyInstallTest(unittest.TestCase):
 
         old_platform = sys.platform
         try:
-            name, script = [i for i in next(get_script_args(dist))][0:2]
+            args = next(get_script_args(dist))
+            name, script = itertools.islice(args, 2)
         finally:
             sys.platform = old_platform
 
-- 
cgit v1.2.1


From 3967fa33dcd84a1ae365961774cd54848bb27900 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 10:39:34 -0500
Subject: Please don't feign a monkey patch when one isn't used.

---
 setuptools/tests/test_easy_install.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 053b6971..95b3fead 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -81,12 +81,8 @@ class TestEasyInstallTest(unittest.TestCase):
     def test_get_script_args(self):
         dist = FakeDist()
 
-        old_platform = sys.platform
-        try:
-            args = next(get_script_args(dist))
-            name, script = itertools.islice(args, 2)
-        finally:
-            sys.platform = old_platform
+        args = next(get_script_args(dist))
+        name, script = itertools.islice(args, 2)
 
         self.assertEqual(script, WANTED)
 
-- 
cgit v1.2.1


From 926b1c8c82655353b8b637c3abc2adc1285425c8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 11:00:34 -0500
Subject: Bumped to 10.0 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 465f8ef8..b8a24734 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '9.2'
+__version__ = '10.0'
-- 
cgit v1.2.1


From b84228bc44ec5e26b576e1e74d1c95630189f9b8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 11:05:51 -0500
Subject: Bumped to 10.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index b8a24734..d5d41219 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '10.0'
+__version__ = '10.1'
-- 
cgit v1.2.1


From 9419ec6858f28bc23fde222c223cc20dc28a0874 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 12:35:21 -0500
Subject: Add test capturing failure. Ref #319.

---
 setuptools/tests/test_easy_install.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 590fce9b..46c2df2c 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -275,6 +275,23 @@ class TestUserInstallTest(unittest.TestCase):
             pass
 
 
+@pytest.yield_fixture
+def distutils_package():
+    distutils_setup_py = SETUP_PY.replace(
+        'from setuptools import setup',
+        'from distutils.core import setup',
+    )
+    with tempdir_context(cd=os.chdir):
+        with open('setup.py', 'w') as f:
+            f.write(distutils_setup_py)
+        yield
+
+
+class TestDistutilsPackage:
+    def test_bdist_egg_available_on_distutils_pkg(self, distutils_package):
+        run_setup('setup.py', ['bdist_egg'])
+
+
 class TestSetupRequires(unittest.TestCase):
 
     def test_setup_requires_honors_fetch_params(self):
-- 
cgit v1.2.1


From fddd230b60c17ca2100e41962de7b9e16ee85408 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 12:37:02 -0500
Subject: Ensure setuptools is present in the environment before invoking
 setup.py from easy_install. Fixes #319.

---
 setuptools/sandbox.py | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index c6840ce4..b90d1e1b 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -152,6 +152,8 @@ def setup_context(setup_dir):
                 with save_argv():
                     with override_temp(temp_dir):
                         with pushd(setup_dir):
+                            # ensure setuptools commands are available
+                            __import__('setuptools')
                             yield
 
 
-- 
cgit v1.2.1


From 8029be0e2f76eb600719f74271850327aa5c1463 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 12:40:16 -0500
Subject: Bumped to 10.0.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index d5d41219..540d81da 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '10.1'
+__version__ = '10.0.1'
-- 
cgit v1.2.1


From d5f207d917ee1ad998545cc0cd86817a609754bd Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 30 Dec 2014 12:40:47 -0500
Subject: Bumped to 10.0.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 540d81da..63388b1f 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '10.0.1'
+__version__ = '10.0.2'
-- 
cgit v1.2.1


From 54e96d8d8a6e18901d8e3e708fd0e82bfaba9569 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 09:52:20 -0500
Subject: Add test capturing requirement. Ref #320.

---
 setuptools/tests/test_sdist.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index bece76d2..090e7304 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -11,6 +11,7 @@ import unicodedata
 import contextlib
 from setuptools.tests.py26compat import skipIf
 
+import pkg_resources
 from setuptools.compat import StringIO, unicode, PY3, PY2
 from setuptools.command.sdist import sdist
 from setuptools.command.egg_info import manifest_maker
@@ -416,5 +417,22 @@ class TestSdistTest(unittest.TestCase):
                 self.assertFalse(filename in cmd.filelist.files)
 
 
+def test_default_revctrl():
+    """
+    When _default_revctrl was removed from the `setuptools.command.sdist`
+    module in 10.0, it broke some systems which keep an old install of
+    setuptools (Distribute) around. Those old versions require that the
+    setuptools package continue to implement that interface, so this
+    function provides that interface, stubbed. See #320 for details.
+
+    This interface must be maintained until Ubuntu 12.04 is no longer
+    supported (by Setuptools).
+    """
+    ep_def = 'svn_cvs = setuptools.command.sdist:_default_revctrl'
+    ep = pkg_resources.EntryPoint.parse(ep_def)
+    res = ep.load(require=False)
+    assert hasattr(res, '__iter__')
+
+
 def test_suite():
     return unittest.defaultTestLoader.loadTestsFromName(__name__)
-- 
cgit v1.2.1


From 314d143ffcc838e1dbf7177b601c139f8d0b609f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 10:15:10 -0500
Subject: Restore _default_revctrl implementation (stubbed). Fixes #320.

---
 setuptools/command/sdist.py | 1 +
 1 file changed, 1 insertion(+)

(limited to 'setuptools')

diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index 371bf547..a4e8288a 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -11,6 +11,7 @@ import pkg_resources
 
 READMES = ('README', 'README.rst', 'README.txt')
 
+_default_revctrl = list
 
 def walk_revctrl(dirname=''):
     """Find all files under revision control"""
-- 
cgit v1.2.1


From 1b2f562052873336769203c661a7a357dd5b5189 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 10:16:24 -0500
Subject: Bumped to 10.1 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index 63388b1f..d5d41219 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '10.0.2'
+__version__ = '10.1'
-- 
cgit v1.2.1


From f61070d6d216a3de70202b5c9cff9a125f1823b9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 10:17:21 -0500
Subject: Bumped to 10.2 in preparation for next release.

---
 setuptools/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/version.py b/setuptools/version.py
index d5d41219..6b917706 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '10.1'
+__version__ = '10.2'
-- 
cgit v1.2.1


From 7e6639875e34bd8150a2c430f4d214da9c197e94 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 10:19:25 -0500
Subject: Remove superfluous parentheses

---
 setuptools/command/sdist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index a4e8288a..3d33df80 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -9,7 +9,7 @@ from setuptools.utils import cs_path_exists
 
 import pkg_resources
 
-READMES = ('README', 'README.rst', 'README.txt')
+READMES = 'README', 'README.rst', 'README.txt'
 
 _default_revctrl = list
 
-- 
cgit v1.2.1


From 80a28fa8c044ccb74e4ae54544be8c449ebd03e8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 12:35:32 -0500
Subject: Use underlying invocation of ._load directly

---
 setuptools/command/test.py     | 2 +-
 setuptools/dist.py             | 3 ++-
 setuptools/tests/test_sdist.py | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index 1038da71..2bf5cb16 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -172,4 +172,4 @@ class test(Command):
         if val is None:
             return
         parsed = EntryPoint.parse("x=" + val)
-        return parsed.load(require=False)()
+        return parsed._load()()
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 7a94d4b3..eb146444 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -434,7 +434,8 @@ class Distribution(_Distribution):
     def print_commands(self):
         for ep in pkg_resources.iter_entry_points('distutils.commands'):
             if ep.name not in self.cmdclass:
-                cmdclass = ep.load(False) # don't require extras, we're not running
+                # don't require extras as the commands won't be invoked
+                cmdclass = ep._load()
                 self.cmdclass[ep.name] = cmdclass
         return _Distribution.print_commands(self)
 
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 090e7304..123e3ea9 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -430,7 +430,7 @@ def test_default_revctrl():
     """
     ep_def = 'svn_cvs = setuptools.command.sdist:_default_revctrl'
     ep = pkg_resources.EntryPoint.parse(ep_def)
-    res = ep.load(require=False)
+    res = ep._load()
     assert hasattr(res, '__iter__')
 
 
-- 
cgit v1.2.1


From ec6e6fb1d2078c619e85fa2eb6290f0cee813e2a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 14:22:53 -0500
Subject: Normalize indentation and whitespace

---
 setuptools/archive_util.py | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py
index 67a67e23..2cd5b34e 100755
--- a/setuptools/archive_util.py
+++ b/setuptools/archive_util.py
@@ -64,20 +64,23 @@ def unpack_directory(filename, extract_dir, progress_filter=default_filter):
     Raises ``UnrecognizedFormat`` if `filename` is not a directory
     """
     if not os.path.isdir(filename):
-        raise UnrecognizedFormat("%s is not a directory" % (filename,))
+        raise UnrecognizedFormat("%s is not a directory" % filename)
 
-    paths = {filename:('',extract_dir)}
+    paths = {
+        filename: ('', extract_dir),
+    }
     for base, dirs, files in os.walk(filename):
-        src,dst = paths[base]
+        src, dst = paths[base]
         for d in dirs:
-            paths[os.path.join(base,d)] = src+d+'/', os.path.join(dst,d)
+            paths[os.path.join(base, d)] = src + d + '/', os.path.join(dst, d)
         for f in files:
-            target = os.path.join(dst,f)
-            target = progress_filter(src+f, target)
+            target = os.path.join(dst, f)
+            target = progress_filter(src + f, target)
             if not target:
-                continue    # skip non-files
+                # skip non-files
+                continue
             ensure_directory(target)
-            f = os.path.join(base,f)
+            f = os.path.join(base, f)
             shutil.copyfile(f, target)
             shutil.copystat(f, target)
 
@@ -112,7 +115,7 @@ def unpack_zipfile(filename, extract_dir, progress_filter=default_filter):
                 # file
                 ensure_directory(target)
                 data = z.read(info.filename)
-                f = open(target,'wb')
+                f = open(target, 'wb')
                 try:
                     f.write(data)
                 finally:
@@ -137,18 +140,21 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter):
             "%s is not a compressed or uncompressed tar file" % (filename,)
         )
     with contextlib.closing(tarobj):
-        tarobj.chown = lambda *args: None   # don't do any chowning!
+        # don't do any chowning!
+        tarobj.chown = lambda *args: None
         for member in tarobj:
             name = member.name
             # don't extract absolute paths or ones with .. in them
             if not name.startswith('/') and '..' not in name.split('/'):
                 prelim_dst = os.path.join(extract_dir, *name.split('/'))
 
-                # resolve any links and to extract the link targets as normal files
+                # resolve any links and to extract the link targets as normal
+                # files
                 while member is not None and (member.islnk() or member.issym()):
                     linkpath = member.linkname
                     if member.issym():
-                        linkpath = posixpath.join(posixpath.dirname(member.name), linkpath)
+                        base = posixpath.dirname(member.name)
+                        linkpath = posixpath.join(base, linkpath)
                         linkpath = posixpath.normpath(linkpath)
                     member = tarobj._getmember(linkpath)
 
@@ -158,9 +164,11 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter):
                         if final_dst.endswith(os.sep):
                             final_dst = final_dst[:-1]
                         try:
-                            tarobj._extract_member(member, final_dst)  # XXX Ugh
+                            # XXX Ugh
+                            tarobj._extract_member(member, final_dst)
                         except tarfile.ExtractError:
-                            pass    # chown/chmod/mkfifo/mknode/makedev failed
+                            # chown/chmod/mkfifo/mknode/makedev failed
+                            pass
         return True
 
 extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile
-- 
cgit v1.2.1


From eb61e5c989cda3f5e021150f91561a88ba6db73e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 14:24:21 -0500
Subject: Use contextlib.closing on tarfile compat shim

---
 setuptools/tests/py26compat.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index e120e744..b1ffa877 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -1,6 +1,7 @@
 import sys
 import unittest
 import tarfile
+import contextlib
 
 try:
 	# provide skipIf for Python 2.4-2.6
@@ -19,9 +20,6 @@ def _tarfile_open_ex(*args, **kwargs):
 	"""
 	Extend result as a context manager.
 	"""
-	res = tarfile.open(*args, **kwargs)
-	res.__exit__ = lambda exc_type, exc_value, traceback: res.close()
-	res.__enter__ = lambda: res
-	return res
+	return contextlib.closing(tarfile.open(*args, **kwargs))
 
 tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open
-- 
cgit v1.2.1


From 86a0dc8419a3649389bd7d58a1f7c79bae0baad6 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 14:29:26 -0500
Subject: Use simple context manager; don't bother deleting the variable.

---
 setuptools/archive_util.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py
index 2cd5b34e..b3c9fa56 100755
--- a/setuptools/archive_util.py
+++ b/setuptools/archive_util.py
@@ -115,12 +115,8 @@ def unpack_zipfile(filename, extract_dir, progress_filter=default_filter):
                 # file
                 ensure_directory(target)
                 data = z.read(info.filename)
-                f = open(target, 'wb')
-                try:
+                with open(target, 'wb') as f:
                     f.write(data)
-                finally:
-                    f.close()
-                    del data
             unix_attributes = info.external_attr >> 16
             if unix_attributes:
                 os.chmod(target, unix_attributes)
-- 
cgit v1.2.1


From 05dfef7ed54dba0f858115be441febc94b79010a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 14:45:33 -0500
Subject: Rewrite assert

---
 setuptools/tests/test_msvc9compiler.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py
index 970f7679..8567aa58 100644
--- a/setuptools/tests/test_msvc9compiler.py
+++ b/setuptools/tests/test_msvc9compiler.py
@@ -7,12 +7,13 @@ finds the Visual C++ for Python package.
 
 import os
 import shutil
-import sys
 import tempfile
 import unittest
 import distutils.errors
 import contextlib
 
+import pytest
+
 # importing only setuptools should apply the patch
 __import__('setuptools')
 
@@ -93,11 +94,8 @@ class TestMSVC9Compiler(unittest.TestCase):
             # skip
             return
 
-        self.assertEqual(
-            "setuptools.msvc9_support",
-            distutils.msvc9compiler.find_vcvarsall.__module__,
-            "find_vcvarsall was not patched"
-        )
+        mod_name = distutils.msvc9compiler.find_vcvarsall.__module__
+        assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched"
 
         find_vcvarsall = distutils.msvc9compiler.find_vcvarsall
         query_vcvarsall = distutils.msvc9compiler.query_vcvarsall
@@ -108,12 +106,10 @@ class TestMSVC9Compiler(unittest.TestCase):
             with MockReg():
                 self.assertIsNone(find_vcvarsall(9.0))
 
-                try:
+                expected = distutils.errors.DistutilsPlatformError
+                with pytest.raises(expected) as exc:
                     query_vcvarsall(9.0)
-                    self.fail('Expected DistutilsPlatformError from query_vcvarsall()')
-                except distutils.errors.DistutilsPlatformError:
-                    exc_message = str(sys.exc_info()[1])
-                self.assertIn('aka.ms/vcpython27', exc_message)
+                assert 'aka.ms/vcpython27' in str(exc)
 
         key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir'
         key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir'
-- 
cgit v1.2.1


From 04cf504041b38b85c8f2e9ffddda5897b2161e67 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 31 Dec 2014 14:48:52 -0500
Subject: Use pytest importorskip for skip logic

---
 setuptools/tests/test_msvc9compiler.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py
index 8567aa58..27747512 100644
--- a/setuptools/tests/test_msvc9compiler.py
+++ b/setuptools/tests/test_msvc9compiler.py
@@ -17,6 +17,8 @@ import pytest
 # importing only setuptools should apply the patch
 __import__('setuptools')
 
+pytest.importorskip("distutils.msvc9compiler")
+
 class MockReg:
     """Mock for distutils.msvc9compiler.Reg. We patch it
     with an instance of this class that mocks out the
@@ -90,10 +92,6 @@ def patch_env(**replacements):
 class TestMSVC9Compiler(unittest.TestCase):
 
     def test_find_vcvarsall_patch(self):
-        if not hasattr(distutils, 'msvc9compiler'):
-            # skip
-            return
-
         mod_name = distutils.msvc9compiler.find_vcvarsall.__module__
         assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched"
 
-- 
cgit v1.2.1


From a75c16ed451046c6c642fb818fe96af55171355e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:00:30 -0500
Subject: Ported window wrapper tests from doctest to unit tests.

---
 setuptools/tests/test_windows_wrappers.py | 178 ++++++++++++++++++++++++++++++
 setuptools/tests/win_script_wrapper.txt   | 154 --------------------------
 2 files changed, 178 insertions(+), 154 deletions(-)
 create mode 100644 setuptools/tests/test_windows_wrappers.py
 delete mode 100644 setuptools/tests/win_script_wrapper.txt

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
new file mode 100644
index 00000000..91012917
--- /dev/null
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -0,0 +1,178 @@
+"""
+Python Script Wrapper for Windows
+=================================
+
+setuptools includes wrappers for Python scripts that allows them to be
+executed like regular windows programs.  There are 2 wrappers, once
+for command-line programs, cli.exe, and one for graphical programs,
+gui.exe.  These programs are almost identical, function pretty much
+the same way, and are generated from the same source file.  The
+wrapper programs are used by copying them to the directory containing
+the script they are to wrap and with the same name as the script they
+are to wrap.
+"""
+
+import os, sys
+import textwrap
+import subprocess
+
+import pytest
+
+from setuptools.command.easy_install import nt_quote_arg
+import pkg_resources
+
+
+pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only")
+
+
+class WrapperTester:
+    @classmethod
+    def create_script(cls, tempdir):
+        """
+        Create a simple script, foo-script.py
+
+        Note that the script starts with a Unix-style '#!' line saying which
+        Python executable to run.  The wrapper will use this line to find the
+        correct Python executable.
+        """
+
+        sample_directory = tempdir
+        script = cls.script_tmpl % dict(python_exe=nt_quote_arg
+            (sys.executable))
+
+        f = open(os.path.join(sample_directory, cls.script_name), 'w')
+        f.write(script)
+        f.close()
+
+        # also copy cli.exe to the sample directory
+
+        f = open(os.path.join(sample_directory, cls.wrapper_name), 'wb')
+        f.write(
+            pkg_resources.resource_string('setuptools', cls.wrapper_source)
+            )
+        f.close()
+
+
+class TestCLI(WrapperTester):
+    script_name = 'foo-script.py'
+    wrapper_source = 'cli-32.exe'
+    wrapper_name = 'foo.exe'
+    script_tmpl = textwrap.dedent("""
+        #!%(python_exe)s
+        import sys
+        input = repr(sys.stdin.read())
+        print(sys.argv[0][-14:])
+        print(sys.argv[1:])
+        print(input)
+        if __debug__:
+            print('non-optimized')
+        """).lstrip()
+
+    def test_basic(self, tmpdir):
+        """
+        When the copy of cli.exe, foo.exe in this example, runs, it examines
+        the path name it was run with and computes a Python script path name
+        by removing the '.exe' suffix and adding the '-script.py' suffix. (For
+        GUI programs, the suffix '-script-pyw' is added.)  This is why we
+        named out script the way we did.  Now we can run out script by running
+        the wrapper:
+
+        This example was a little pathological in that it exercised windows
+        (MS C runtime) quoting rules:
+
+        - Strings containing spaces are surrounded by double quotes.
+
+        - Double quotes in strings need to be escaped by preceding them with
+          back slashes.
+
+        - One or more backslashes preceding double quotes need to be escaped
+          by preceding each of them with back slashes.
+        """
+        sample_directory = str(tmpdir)
+        self.create_script(sample_directory)
+        cmd = [os.path.join(sample_directory, 'foo.exe'), 'arg1', 'arg 2',
+            'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
+        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+        stdout, stderr = proc.communicate('hello\nworld\n'.encode('ascii'))
+        actual = stdout.decode('ascii').replace('\r\n', '\n')
+        expected = textwrap.dedent(r"""
+            \foo-script.py
+            ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
+            'hello\nworld\n'
+            non-optimized
+            """).lstrip()
+        assert actual == expected
+
+    def test_with_options(self, tmpdir):
+        """
+        Specifying Python Command-line Options
+        --------------------------------------
+
+        You can specify a single argument on the '#!' line.  This can be used
+        to specify Python options like -O, to run in optimized mode or -i
+        to start the interactive interpreter.  You can combine multiple
+        options as usual. For example, to run in optimized mode and
+        enter the interpreter after running the script, you could use -Oi:
+        """
+        sample_directory = str(tmpdir)
+        self.create_script(sample_directory)
+        f = open(os.path.join(sample_directory, 'foo-script.py'), 'w')
+        f.write(textwrap.dedent("""
+            #!%(python_exe)s  -Oi
+            import sys
+            input = repr(sys.stdin.read())
+            print(sys.argv[0][-14:])
+            print(sys.argv[1:])
+            print(input)
+            if __debug__:
+                print('non-optimized')
+            sys.ps1 = '---'
+            """).lstrip() % dict(python_exe=nt_quote_arg(sys.executable)))
+        f.close()
+        cmd = [os.path.join(sample_directory, 'foo.exe')]
+        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
+        stdout, stderr = proc.communicate()
+        actual = stdout.decode('ascii').replace('\r\n', '\n')
+        expected = textwrap.dedent(r"""
+            \foo-script.py
+            []
+            ''
+            ---
+            """).lstrip()
+        assert actual == expected
+
+
+class TestGUI(WrapperTester):
+    """
+    Testing the GUI Version
+    -----------------------
+    """
+    script_name = 'bar-script.pyw'
+    wrapper_source = 'gui-32.exe'
+    wrapper_name = 'bar.exe'
+
+    script_tmpl = textwrap.dedent("""
+        #!%(python_exe)s
+        import sys
+        f = open(sys.argv[1], 'wb')
+        bytes_written = f.write(repr(sys.argv[2]).encode('utf-8'))
+        f.close()
+        """).strip()
+
+    def test_basic(self, tmpdir):
+        """Test the GUI version with the simple scipt, bar-script.py"""
+        sample_directory = str(tmpdir)
+        self.create_script(sample_directory)
+
+        cmd = [
+            os.path.join(sample_directory, 'bar.exe'),
+            os.path.join(sample_directory, 'test_output.txt'),
+            'Test Argument',
+        ]
+        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
+        stdout, stderr = proc.communicate()
+        assert not stdout
+        assert not stderr
+        f_out = open(os.path.join(sample_directory, 'test_output.txt'), 'rb')
+        assert f_out.read().decode('ascii') == repr('Test Argument')
+        f_out.close()
diff --git a/setuptools/tests/win_script_wrapper.txt b/setuptools/tests/win_script_wrapper.txt
deleted file mode 100644
index b3a52e0a..00000000
--- a/setuptools/tests/win_script_wrapper.txt
+++ /dev/null
@@ -1,154 +0,0 @@
-Python Script Wrapper for Windows
-=================================
-
-setuptools includes wrappers for Python scripts that allows them to be
-executed like regular windows programs.  There are 2 wrappers, once
-for command-line programs, cli.exe, and one for graphical programs,
-gui.exe.  These programs are almost identical, function pretty much
-the same way, and are generated from the same source file.  The
-wrapper programs are used by copying them to the directory containing
-the script they are to wrap and with the same name as the script they
-are to wrap.  In the rest of this document, we'll give an example that
-will illustrate this.
-
-Let's create a simple script, foo-script.py:
-
-    >>> import os, sys, tempfile
-    >>> from setuptools.command.easy_install import nt_quote_arg
-    >>> sample_directory = tempfile.mkdtemp()
-    >>> f = open(os.path.join(sample_directory, 'foo-script.py'), 'w')
-    >>> bytes_written = f.write(
-    ... """#!%(python_exe)s
-    ... import sys
-    ... input = repr(sys.stdin.read())
-    ... print(sys.argv[0][-14:])
-    ... print(sys.argv[1:])
-    ... print(input)
-    ... if __debug__:
-    ...     print('non-optimized')
-    ... """ % dict(python_exe=nt_quote_arg(sys.executable)))
-    >>> f.close()
-
-Note that the script starts with a Unix-style '#!' line saying which
-Python executable to run.  The wrapper will use this to find the
-correct Python executable.
-
-We'll also copy cli.exe to the sample-directory with the name foo.exe:
-
-    >>> import pkg_resources
-    >>> f = open(os.path.join(sample_directory, 'foo.exe'), 'wb')
-    >>> bytes_written = f.write(
-    ...     pkg_resources.resource_string('setuptools', 'cli-32.exe')
-    ...     )
-    >>> f.close()
-
-When the copy of cli.exe, foo.exe in this example, runs, it examines
-the path name it was run with and computes a Python script path name
-by removing the '.exe' suffix and adding the '-script.py' suffix. (For
-GUI programs, the suffix '-script-pyw' is added.)  This is why we
-named out script the way we did.  Now we can run out script by running
-the wrapper:
-
-    >>> import subprocess
-    >>> cmd = [os.path.join(sample_directory, 'foo.exe'), 'arg1', 'arg 2',
-    ...     'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
-    >>> proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
-    >>> stdout, stderr = proc.communicate('hello\nworld\n'.encode('ascii'))
-    >>> bytes = sys.stdout.write(stdout.decode('ascii').replace('\r\n', '\n'))
-    \foo-script.py
-    ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
-    'hello\nworld\n'
-    non-optimized
-
-This example was a little pathological in that it exercised windows
-(MS C runtime) quoting rules:
-
-- Strings containing spaces are surrounded by double quotes.
-
-- Double quotes in strings need to be escaped by preceding them with
-  back slashes.
-
-- One or more backslashes preceding double quotes need to be escaped
-  by preceding each of them with back slashes.
-
-
-Specifying Python Command-line Options
---------------------------------------
-
-You can specify a single argument on the '#!' line.  This can be used
-to specify Python options like -O, to run in optimized mode or -i
-to start the interactive interpreter.  You can combine multiple
-options as usual. For example, to run in optimized mode and
-enter the interpreter after running the script, you could use -Oi:
-
-    >>> f = open(os.path.join(sample_directory, 'foo-script.py'), 'w')
-    >>> bytes_written = f.write(
-    ... """#!%(python_exe)s  -Oi
-    ... import sys
-    ... input = repr(sys.stdin.read())
-    ... print(sys.argv[0][-14:])
-    ... print(sys.argv[1:])
-    ... print(input)
-    ... if __debug__:
-    ...     print('non-optimized')
-    ... sys.ps1 = '---'
-    ... """ % dict(python_exe=nt_quote_arg(sys.executable)))
-    >>> f.close()
-    >>> cmd = [os.path.join(sample_directory, 'foo.exe')]
-    >>> proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
-    >>> stdout, stderr = proc.communicate()
-    >>> bytes = sys.stdout.write(stdout.decode('ascii').replace('\r\n', '\n'))
-    \foo-script.py
-    []
-    ''
-    ---
-
-Testing the GUI Version
------------------------
-
-Now let's test the GUI version with the simple scipt, bar-script.py:
-
-    >>> import os, sys, tempfile
-    >>> from setuptools.command.easy_install import nt_quote_arg
-    >>> sample_directory = tempfile.mkdtemp()
-    >>> f = open(os.path.join(sample_directory, 'bar-script.pyw'), 'w')
-    >>> bytes_written = f.write(
-    ... """#!%(python_exe)s
-    ... import sys
-    ... f = open(sys.argv[1], 'wb')
-    ... bytes_written = f.write(repr(sys.argv[2]).encode('utf-8'))
-    ... f.close()
-    ... """ % dict(python_exe=nt_quote_arg(sys.executable)))
-    >>> f.close()
-
-We'll also copy gui.exe to the sample-directory with the name bar.exe:
-
-    >>> import pkg_resources
-    >>> f = open(os.path.join(sample_directory, 'bar.exe'), 'wb')
-    >>> bytes_written = f.write(
-    ...     pkg_resources.resource_string('setuptools', 'gui-32.exe')
-    ...     )
-    >>> f.close()
-
-Finally, we'll run the script and check the result:
-
-    >>> cmd = [
-    ...     os.path.join(sample_directory, 'bar.exe'),
-    ...     os.path.join(sample_directory, 'test_output.txt'),
-    ...     'Test Argument',
-    ... ]
-    >>> proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
-    >>> stdout, stderr = proc.communicate()
-    >>> print(stdout.decode('ascii'))
-    
-    >>> f_out = open(os.path.join(sample_directory, 'test_output.txt'), 'rb')
-    >>> print(f_out.read().decode('ascii'))
-    'Test Argument'
-    >>> f_out.close()
-
-
-We're done with the sample_directory:
-
-    >>> import shutil
-    >>> shutil.rmtree(sample_directory)
-
-- 
cgit v1.2.1


From aee1868928e70bc6fdbd91649d596380646bf481 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:03:18 -0500
Subject: Simplify script creation with context managers and leveraging local
 variables for the template population.

---
 setuptools/tests/test_windows_wrappers.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 91012917..92e9f882 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -37,20 +37,16 @@ class WrapperTester:
         """
 
         sample_directory = tempdir
-        script = cls.script_tmpl % dict(python_exe=nt_quote_arg
-            (sys.executable))
+        python_exe = nt_quote_arg(sys.executable)
+        script = cls.script_tmpl % locals()
 
-        f = open(os.path.join(sample_directory, cls.script_name), 'w')
-        f.write(script)
-        f.close()
+        with open(os.path.join(sample_directory, cls.script_name), 'w') as f:
+            f.write(script)
 
         # also copy cli.exe to the sample directory
-
-        f = open(os.path.join(sample_directory, cls.wrapper_name), 'wb')
-        f.write(
-            pkg_resources.resource_string('setuptools', cls.wrapper_source)
-            )
-        f.close()
+        with open(os.path.join(sample_directory, cls.wrapper_name), 'wb') as f:
+            w = pkg_resources.resource_string('setuptools', cls.wrapper_source)
+            f.write(w)
 
 
 class TestCLI(WrapperTester):
-- 
cgit v1.2.1


From 17f9e3abbd8b6ed2e1bb941f9f37659d9bf757f0 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:07:02 -0500
Subject: More context managers

---
 setuptools/tests/test_windows_wrappers.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 92e9f882..29aa9c6d 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -112,8 +112,7 @@ class TestCLI(WrapperTester):
         """
         sample_directory = str(tmpdir)
         self.create_script(sample_directory)
-        f = open(os.path.join(sample_directory, 'foo-script.py'), 'w')
-        f.write(textwrap.dedent("""
+        tmpl = textwrap.dedent("""
             #!%(python_exe)s  -Oi
             import sys
             input = repr(sys.stdin.read())
@@ -123,8 +122,9 @@ class TestCLI(WrapperTester):
             if __debug__:
                 print('non-optimized')
             sys.ps1 = '---'
-            """).lstrip() % dict(python_exe=nt_quote_arg(sys.executable)))
-        f.close()
+            """).lstrip()
+        with open(os.path.join(sample_directory, 'foo-script.py'), 'w') as f:
+            f.write(tmpl % dict(python_exe=nt_quote_arg(sys.executable)))
         cmd = [os.path.join(sample_directory, 'foo.exe')]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
         stdout, stderr = proc.communicate()
@@ -169,6 +169,6 @@ class TestGUI(WrapperTester):
         stdout, stderr = proc.communicate()
         assert not stdout
         assert not stderr
-        f_out = open(os.path.join(sample_directory, 'test_output.txt'), 'rb')
-        assert f_out.read().decode('ascii') == repr('Test Argument')
-        f_out.close()
+        with open(os.path.join(sample_directory, 'test_output.txt'), 'rb') as f_out:
+            actual = f_out.read().decode('ascii')
+        assert actual == repr('Test Argument')
-- 
cgit v1.2.1


From f43351575a3f92cd5422973a03c577f787c5898c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:09:10 -0500
Subject: Update docs

---
 setuptools/tests/test_windows_wrappers.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 29aa9c6d..0e165bd9 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -3,7 +3,7 @@ Python Script Wrapper for Windows
 =================================
 
 setuptools includes wrappers for Python scripts that allows them to be
-executed like regular windows programs.  There are 2 wrappers, once
+executed like regular windows programs.  There are 2 wrappers, one
 for command-line programs, cli.exe, and one for graphical programs,
 gui.exe.  These programs are almost identical, function pretty much
 the same way, and are generated from the same source file.  The
@@ -69,7 +69,7 @@ class TestCLI(WrapperTester):
         When the copy of cli.exe, foo.exe in this example, runs, it examines
         the path name it was run with and computes a Python script path name
         by removing the '.exe' suffix and adding the '-script.py' suffix. (For
-        GUI programs, the suffix '-script-pyw' is added.)  This is why we
+        GUI programs, the suffix '-script.pyw' is added.)  This is why we
         named out script the way we did.  Now we can run out script by running
         the wrapper:
 
-- 
cgit v1.2.1


From 88b8ad6b797cb9dcd898fc1b125dc90cc35c565f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:13:58 -0500
Subject: Extract prep_script method

---
 setuptools/tests/test_windows_wrappers.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 0e165bd9..187177f7 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -26,6 +26,12 @@ pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only")
 
 
 class WrapperTester:
+
+    @classmethod
+    def prep_script(cls, template):
+        python_exe = nt_quote_arg(sys.executable)
+        return template % locals()
+
     @classmethod
     def create_script(cls, tempdir):
         """
@@ -37,8 +43,7 @@ class WrapperTester:
         """
 
         sample_directory = tempdir
-        python_exe = nt_quote_arg(sys.executable)
-        script = cls.script_tmpl % locals()
+        script = cls.prep_script(cls.script_tmpl)
 
         with open(os.path.join(sample_directory, cls.script_name), 'w') as f:
             f.write(script)
@@ -124,7 +129,7 @@ class TestCLI(WrapperTester):
             sys.ps1 = '---'
             """).lstrip()
         with open(os.path.join(sample_directory, 'foo-script.py'), 'w') as f:
-            f.write(tmpl % dict(python_exe=nt_quote_arg(sys.executable)))
+            f.write(self.prep_script(tmpl))
         cmd = [os.path.join(sample_directory, 'foo.exe')]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
         stdout, stderr = proc.communicate()
-- 
cgit v1.2.1


From 506d6f75a02e7943efbada210798c4798fb89835 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:16:32 -0500
Subject: Leverage LocalPath characteristics of tmpdir.

---
 setuptools/tests/test_windows_wrappers.py | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 187177f7..70e23a40 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -12,7 +12,7 @@ the script they are to wrap and with the same name as the script they
 are to wrap.
 """
 
-import os, sys
+import sys
 import textwrap
 import subprocess
 
@@ -33,7 +33,7 @@ class WrapperTester:
         return template % locals()
 
     @classmethod
-    def create_script(cls, tempdir):
+    def create_script(cls, tmpdir):
         """
         Create a simple script, foo-script.py
 
@@ -42,14 +42,13 @@ class WrapperTester:
         correct Python executable.
         """
 
-        sample_directory = tempdir
         script = cls.prep_script(cls.script_tmpl)
 
-        with open(os.path.join(sample_directory, cls.script_name), 'w') as f:
+        with (tmpdir / cls.script_name).open('w') as f:
             f.write(script)
 
         # also copy cli.exe to the sample directory
-        with open(os.path.join(sample_directory, cls.wrapper_name), 'wb') as f:
+        with (tmpdir / cls.wrapper_name).open('wb') as f:
             w = pkg_resources.resource_string('setuptools', cls.wrapper_source)
             f.write(w)
 
@@ -89,9 +88,8 @@ class TestCLI(WrapperTester):
         - One or more backslashes preceding double quotes need to be escaped
           by preceding each of them with back slashes.
         """
-        sample_directory = str(tmpdir)
-        self.create_script(sample_directory)
-        cmd = [os.path.join(sample_directory, 'foo.exe'), 'arg1', 'arg 2',
+        self.create_script(tmpdir)
+        cmd = [str(tmpdir / 'foo.exe'), 'arg1', 'arg 2',
             'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
         stdout, stderr = proc.communicate('hello\nworld\n'.encode('ascii'))
@@ -115,8 +113,7 @@ class TestCLI(WrapperTester):
         options as usual. For example, to run in optimized mode and
         enter the interpreter after running the script, you could use -Oi:
         """
-        sample_directory = str(tmpdir)
-        self.create_script(sample_directory)
+        self.create_script(tmpdir)
         tmpl = textwrap.dedent("""
             #!%(python_exe)s  -Oi
             import sys
@@ -128,9 +125,9 @@ class TestCLI(WrapperTester):
                 print('non-optimized')
             sys.ps1 = '---'
             """).lstrip()
-        with open(os.path.join(sample_directory, 'foo-script.py'), 'w') as f:
+        with (tmpdir / 'foo-script.py').open('w') as f:
             f.write(self.prep_script(tmpl))
-        cmd = [os.path.join(sample_directory, 'foo.exe')]
+        cmd = [str(tmpdir / 'foo.exe')]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
         stdout, stderr = proc.communicate()
         actual = stdout.decode('ascii').replace('\r\n', '\n')
@@ -162,18 +159,17 @@ class TestGUI(WrapperTester):
 
     def test_basic(self, tmpdir):
         """Test the GUI version with the simple scipt, bar-script.py"""
-        sample_directory = str(tmpdir)
-        self.create_script(sample_directory)
+        self.create_script(tmpdir)
 
         cmd = [
-            os.path.join(sample_directory, 'bar.exe'),
-            os.path.join(sample_directory, 'test_output.txt'),
+            str(tmpdir / 'bar.exe'),
+            str(tmpdir / 'test_output.txt'),
             'Test Argument',
         ]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
         stdout, stderr = proc.communicate()
         assert not stdout
         assert not stderr
-        with open(os.path.join(sample_directory, 'test_output.txt'), 'rb') as f_out:
+        with (tmpdir / 'test_output.txt').open('rb') as f_out:
             actual = f_out.read().decode('ascii')
         assert actual == repr('Test Argument')
-- 
cgit v1.2.1


From 64b8fc3f09adb0843bae6f118da8147b8697e4dd Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:23:57 -0500
Subject: Reindent for clarity

---
 setuptools/tests/test_windows_wrappers.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 70e23a40..b6c1e573 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -89,8 +89,14 @@ class TestCLI(WrapperTester):
           by preceding each of them with back slashes.
         """
         self.create_script(tmpdir)
-        cmd = [str(tmpdir / 'foo.exe'), 'arg1', 'arg 2',
-            'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
+        cmd = [
+            str(tmpdir / 'foo.exe'),
+            'arg1',
+            'arg 2',
+            'arg "2\\"',
+            'arg 4\\',
+            'arg5 a\\\\b',
+        ]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
         stdout, stderr = proc.communicate('hello\nworld\n'.encode('ascii'))
         actual = stdout.decode('ascii').replace('\r\n', '\n')
-- 
cgit v1.2.1


From 0ede8363da2b989b2b498bf16eb6d30a6ae088ac Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:25:02 -0500
Subject: Remove additional tests, no longer relevant.

---
 setuptools/tests/__init__.py | 12 ------------
 1 file changed, 12 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index e5d6545a..3aa5525d 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -2,7 +2,6 @@
 import sys
 import os
 import unittest
-import doctest
 import distutils.core
 import distutils.cmd
 from distutils.errors import DistutilsOptionError, DistutilsPlatformError
@@ -16,17 +15,6 @@ import setuptools.depends as dep
 from setuptools import Feature
 from setuptools.depends import Require
 
-def additional_tests():
-    suite = unittest.TestSuite((
-        doctest.DocFileSuite(
-            'api_tests.txt',
-            optionflags=doctest.ELLIPSIS, package='pkg_resources',
-            ),
-        ))
-    if sys.platform == 'win32':
-        suite.addTest(doctest.DocFileSuite('win_script_wrapper.txt'))
-    return suite
-
 def makeSetup(**args):
     """Return distribution from 'setup(**args)', without executing commands"""
 
-- 
cgit v1.2.1


From 81c4405729df21fe5326df0bc2f2ed3e99d3e735 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:33:08 -0500
Subject: Convert DependsTests to pytest discovered tests.

---
 setuptools/tests/__init__.py | 77 ++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 39 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index 3aa5525d..bb3a0b31 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -10,6 +10,8 @@ from distutils.core import Extension
 from distutils.version import LooseVersion
 from setuptools.compat import func_code
 
+import pytest
+
 import setuptools.dist
 import setuptools.depends as dep
 from setuptools import Feature
@@ -29,7 +31,7 @@ def makeSetup(**args):
         distutils.core._setup_stop_after = None
 
 
-class DependsTests(unittest.TestCase):
+class TestDepends:
 
     def testExtractConst(self):
         if not hasattr(dep, 'extract_constant'):
@@ -42,21 +44,24 @@ class DependsTests(unittest.TestCase):
             y = z
 
         fc = func_code(f1)
+
         # unrecognized name
-        self.assertEqual(dep.extract_constant(fc,'q', -1), None)
+        assert dep.extract_constant(fc,'q', -1) is None
 
         # constant assigned
-        self.assertEqual(dep.extract_constant(fc,'x', -1), "test")
+        dep.extract_constant(fc,'x', -1) == "test"
 
         # expression assigned
-        self.assertEqual(dep.extract_constant(fc,'y', -1), -1)
+        dep.extract_constant(fc,'y', -1) == -1
 
         # recognized name, not assigned
-        self.assertEqual(dep.extract_constant(fc,'z', -1), None)
+        dep.extract_constant(fc,'z', -1) is None
 
     def testFindModule(self):
-        self.assertRaises(ImportError, dep.find_module, 'no-such.-thing')
-        self.assertRaises(ImportError, dep.find_module, 'setuptools.non-existent')
+        with pytest.raises(ImportError):
+            dep.find_module('no-such.-thing')
+        with pytest.raises(ImportError):
+            dep.find_module('setuptools.non-existent')
         f,p,i = dep.find_module('setuptools.tests')
         f.close()
 
@@ -66,15 +71,9 @@ class DependsTests(unittest.TestCase):
             return
 
         from email import __version__
-        self.assertEqual(
-            dep.get_module_constant('email','__version__'), __version__
-        )
-        self.assertEqual(
-            dep.get_module_constant('sys','version'), sys.version
-        )
-        self.assertEqual(
-            dep.get_module_constant('setuptools.tests','__doc__'),__doc__
-        )
+        assert dep.get_module_constant('email','__version__') == __version__
+        assert dep.get_module_constant('sys','version') == sys.version
+        assert dep.get_module_constant('setuptools.tests','__doc__') == __doc__
 
     def testRequire(self):
         if not hasattr(dep, 'extract_constant'):
@@ -83,40 +82,40 @@ class DependsTests(unittest.TestCase):
 
         req = Require('Email','1.0.3','email')
 
-        self.assertEqual(req.name, 'Email')
-        self.assertEqual(req.module, 'email')
-        self.assertEqual(req.requested_version, '1.0.3')
-        self.assertEqual(req.attribute, '__version__')
-        self.assertEqual(req.full_name(), 'Email-1.0.3')
+        assert req.name == 'Email'
+        assert req.module == 'email'
+        assert req.requested_version == '1.0.3'
+        assert req.attribute == '__version__'
+        assert req.full_name() == 'Email-1.0.3'
 
         from email import __version__
-        self.assertEqual(req.get_version(), __version__)
-        self.assertTrue(req.version_ok('1.0.9'))
-        self.assertTrue(not req.version_ok('0.9.1'))
-        self.assertTrue(not req.version_ok('unknown'))
+        assert req.get_version() == __version__
+        assert req.version_ok('1.0.9')
+        assert not req.version_ok('0.9.1')
+        assert not req.version_ok('unknown')
 
-        self.assertTrue(req.is_present())
-        self.assertTrue(req.is_current())
+        assert req.is_present()
+        assert req.is_current()
 
         req = Require('Email 3000','03000','email',format=LooseVersion)
-        self.assertTrue(req.is_present())
-        self.assertTrue(not req.is_current())
-        self.assertTrue(not req.version_ok('unknown'))
+        assert req.is_present()
+        assert not req.is_current()
+        assert not req.version_ok('unknown')
 
         req = Require('Do-what-I-mean','1.0','d-w-i-m')
-        self.assertTrue(not req.is_present())
-        self.assertTrue(not req.is_current())
+        assert not req.is_present()
+        assert not req.is_current()
 
         req = Require('Tests', None, 'tests', homepage="http://example.com")
-        self.assertEqual(req.format, None)
-        self.assertEqual(req.attribute, None)
-        self.assertEqual(req.requested_version, None)
-        self.assertEqual(req.full_name(), 'Tests')
-        self.assertEqual(req.homepage, 'http://example.com')
+        assert req.format is None
+        assert req.attribute is None
+        assert req.requested_version is None
+        assert req.full_name() == 'Tests'
+        assert req.homepage == 'http://example.com'
 
         paths = [os.path.dirname(p) for p in __path__]
-        self.assertTrue(req.is_present(paths))
-        self.assertTrue(req.is_current(paths))
+        assert req.is_present(paths)
+        assert req.is_current(paths)
 
 
 class DistroTests(unittest.TestCase):
-- 
cgit v1.2.1


From c10ab0661e13776146e2948c67593c65035ccf8c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:36:43 -0500
Subject: Unify detection of bytecode

---
 setuptools/tests/__init__.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index bb3a0b31..900b0199 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -31,6 +31,11 @@ def makeSetup(**args):
         distutils.core._setup_stop_after = None
 
 
+needs_bytecode = pytest.mark.skipif(
+    not hasattr(dep, 'get_module_constant'),
+    reason="bytecode support not available",
+)
+
 class TestDepends:
 
     def testExtractConst(self):
@@ -65,21 +70,15 @@ class TestDepends:
         f,p,i = dep.find_module('setuptools.tests')
         f.close()
 
+    @needs_bytecode
     def testModuleExtract(self):
-        if not hasattr(dep, 'get_module_constant'):
-            # skip on non-bytecode platforms
-            return
-
         from email import __version__
         assert dep.get_module_constant('email','__version__') == __version__
         assert dep.get_module_constant('sys','version') == sys.version
         assert dep.get_module_constant('setuptools.tests','__doc__') == __doc__
 
+    @needs_bytecode
     def testRequire(self):
-        if not hasattr(dep, 'extract_constant'):
-            # skip on non-bytecode platformsh
-            return
-
         req = Require('Email','1.0.3','email')
 
         assert req.name == 'Email'
-- 
cgit v1.2.1


From 5a2207aefc31c5cefc07d26957f8b1c23694d5f8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 11:48:22 -0500
Subject: Removed remainder of unittest dependence in
 setuptools/tests/__init__.py

---
 setuptools/tests/__init__.py | 179 ++++++++++++++++++++-----------------------
 1 file changed, 83 insertions(+), 96 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index 900b0199..b8a29cba 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -1,7 +1,6 @@
 """Tests for the 'setuptools' package"""
 import sys
 import os
-import unittest
 import distutils.core
 import distutils.cmd
 from distutils.errors import DistutilsOptionError, DistutilsPlatformError
@@ -117,9 +116,9 @@ class TestDepends:
         assert req.is_current(paths)
 
 
-class DistroTests(unittest.TestCase):
+class TestDistro:
 
-    def setUp(self):
+    def setup_method(self, method):
         self.e1 = Extension('bar.ext',['bar.c'])
         self.e2 = Extension('c.y', ['y.c'])
 
@@ -131,21 +130,21 @@ class DistroTests(unittest.TestCase):
         )
 
     def testDistroType(self):
-        self.assertTrue(isinstance(self.dist,setuptools.dist.Distribution))
+        assert isinstance(self.dist,setuptools.dist.Distribution)
 
     def testExcludePackage(self):
         self.dist.exclude_package('a')
-        self.assertEqual(self.dist.packages, ['b','c'])
+        assert self.dist.packages == ['b','c']
 
         self.dist.exclude_package('b')
-        self.assertEqual(self.dist.packages, ['c'])
-        self.assertEqual(self.dist.py_modules, ['x'])
-        self.assertEqual(self.dist.ext_modules, [self.e1, self.e2])
+        assert self.dist.packages == ['c']
+        assert self.dist.py_modules == ['x']
+        assert self.dist.ext_modules == [self.e1, self.e2]
 
         self.dist.exclude_package('c')
-        self.assertEqual(self.dist.packages, [])
-        self.assertEqual(self.dist.py_modules, ['x'])
-        self.assertEqual(self.dist.ext_modules, [self.e1])
+        assert self.dist.packages == []
+        assert self.dist.py_modules == ['x']
+        assert self.dist.ext_modules == [self.e1]
 
         # test removals from unspecified options
         makeSetup().exclude_package('x')
@@ -153,21 +152,21 @@ class DistroTests(unittest.TestCase):
     def testIncludeExclude(self):
         # remove an extension
         self.dist.exclude(ext_modules=[self.e1])
-        self.assertEqual(self.dist.ext_modules, [self.e2])
+        assert self.dist.ext_modules == [self.e2]
 
         # add it back in
         self.dist.include(ext_modules=[self.e1])
-        self.assertEqual(self.dist.ext_modules, [self.e2, self.e1])
+        assert self.dist.ext_modules == [self.e2, self.e1]
 
         # should not add duplicate
         self.dist.include(ext_modules=[self.e1])
-        self.assertEqual(self.dist.ext_modules, [self.e2, self.e1])
+        assert self.dist.ext_modules == [self.e2, self.e1]
 
     def testExcludePackages(self):
         self.dist.exclude(packages=['c','b','a'])
-        self.assertEqual(self.dist.packages, [])
-        self.assertEqual(self.dist.py_modules, ['x'])
-        self.assertEqual(self.dist.ext_modules, [self.e1])
+        assert self.dist.packages == []
+        assert self.dist.py_modules == ['x']
+        assert self.dist.ext_modules == [self.e1]
 
     def testEmpty(self):
         dist = makeSetup()
@@ -176,49 +175,41 @@ class DistroTests(unittest.TestCase):
         dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
 
     def testContents(self):
-        self.assertTrue(self.dist.has_contents_for('a'))
+        assert self.dist.has_contents_for('a')
         self.dist.exclude_package('a')
-        self.assertTrue(not self.dist.has_contents_for('a'))
+        assert not self.dist.has_contents_for('a')
 
-        self.assertTrue(self.dist.has_contents_for('b'))
+        assert self.dist.has_contents_for('b')
         self.dist.exclude_package('b')
-        self.assertTrue(not self.dist.has_contents_for('b'))
+        assert not self.dist.has_contents_for('b')
 
-        self.assertTrue(self.dist.has_contents_for('c'))
+        assert self.dist.has_contents_for('c')
         self.dist.exclude_package('c')
-        self.assertTrue(not self.dist.has_contents_for('c'))
+        assert not self.dist.has_contents_for('c')
 
     def testInvalidIncludeExclude(self):
-        self.assertRaises(DistutilsSetupError,
-            self.dist.include, nonexistent_option='x'
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.exclude, nonexistent_option='x'
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.include, packages={'x':'y'}
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.exclude, packages={'x':'y'}
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.include, ext_modules={'x':'y'}
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.exclude, ext_modules={'x':'y'}
-        )
-
-        self.assertRaises(DistutilsSetupError,
-            self.dist.include, package_dir=['q']
-        )
-        self.assertRaises(DistutilsSetupError,
-            self.dist.exclude, package_dir=['q']
-        )
-
-
-class FeatureTests(unittest.TestCase):
-
-    def setUp(self):
+        with pytest.raises(DistutilsSetupError):
+            self.dist.include(nonexistent_option='x')
+        with pytest.raises(DistutilsSetupError):
+            self.dist.exclude(nonexistent_option='x')
+        with pytest.raises(DistutilsSetupError):
+            self.dist.include(packages={'x':'y'})
+        with pytest.raises(DistutilsSetupError):
+            self.dist.exclude(packages={'x':'y'})
+        with pytest.raises(DistutilsSetupError):
+            self.dist.include(ext_modules={'x':'y'})
+        with pytest.raises(DistutilsSetupError):
+            self.dist.exclude(ext_modules={'x':'y'})
+
+        with pytest.raises(DistutilsSetupError):
+            self.dist.include(package_dir=['q'])
+        with pytest.raises(DistutilsSetupError):
+            self.dist.exclude(package_dir=['q'])
+
+
+class TestFeatures:
+
+    def setup_method(self, method):
         self.req = Require('Distutils','1.0.3','distutils')
         self.dist = makeSetup(
             features={
@@ -240,80 +231,75 @@ class FeatureTests(unittest.TestCase):
         )
 
     def testDefaults(self):
-        self.assertTrue(not
-            Feature(
-                "test",standard=True,remove='x',available=False
-            ).include_by_default()
-        )
-        self.assertTrue(
-            Feature("test",standard=True,remove='x').include_by_default()
-        )
+        assert not Feature(
+            "test",standard=True,remove='x',available=False
+        ).include_by_default()
+        assert Feature("test",standard=True,remove='x').include_by_default()
         # Feature must have either kwargs, removes, or require_features
-        self.assertRaises(DistutilsSetupError, Feature, "test")
+        with pytest.raises(DistutilsSetupError):
+            Feature("test")
 
     def testAvailability(self):
-        self.assertRaises(
-            DistutilsPlatformError,
-            self.dist.features['dwim'].include_in, self.dist
-        )
+        with pytest.raises(DistutilsPlatformError):
+            self.dist.features['dwim'].include_in(self.dist)
 
     def testFeatureOptions(self):
         dist = self.dist
-        self.assertTrue(
+        assert (
             ('with-dwim',None,'include DWIM') in dist.feature_options
         )
-        self.assertTrue(
+        assert (
             ('without-dwim',None,'exclude DWIM (default)') in dist.feature_options
         )
-        self.assertTrue(
+        assert (
             ('with-bar',None,'include bar (default)') in dist.feature_options
         )
-        self.assertTrue(
+        assert (
             ('without-bar',None,'exclude bar') in dist.feature_options
         )
-        self.assertEqual(dist.feature_negopt['without-foo'],'with-foo')
-        self.assertEqual(dist.feature_negopt['without-bar'],'with-bar')
-        self.assertEqual(dist.feature_negopt['without-dwim'],'with-dwim')
-        self.assertTrue(not 'without-baz' in dist.feature_negopt)
+        assert dist.feature_negopt['without-foo'] == 'with-foo'
+        assert dist.feature_negopt['without-bar'] == 'with-bar'
+        assert dist.feature_negopt['without-dwim'] == 'with-dwim'
+        assert (not 'without-baz' in dist.feature_negopt)
 
     def testUseFeatures(self):
         dist = self.dist
-        self.assertEqual(dist.with_foo,1)
-        self.assertEqual(dist.with_bar,0)
-        self.assertEqual(dist.with_baz,1)
-        self.assertTrue(not 'bar_et' in dist.py_modules)
-        self.assertTrue(not 'pkg.bar' in dist.packages)
-        self.assertTrue('pkg.baz' in dist.packages)
-        self.assertTrue('scripts/baz_it' in dist.scripts)
-        self.assertTrue(('libfoo','foo/foofoo.c') in dist.libraries)
-        self.assertEqual(dist.ext_modules,[])
-        self.assertEqual(dist.require_features, [self.req])
+        assert dist.with_foo == 1
+        assert dist.with_bar == 0
+        assert dist.with_baz == 1
+        assert (not 'bar_et' in dist.py_modules)
+        assert (not 'pkg.bar' in dist.packages)
+        assert ('pkg.baz' in dist.packages)
+        assert ('scripts/baz_it' in dist.scripts)
+        assert (('libfoo','foo/foofoo.c') in dist.libraries)
+        assert dist.ext_modules == []
+        assert dist.require_features == [self.req]
 
         # If we ask for bar, it should fail because we explicitly disabled
         # it on the command line
-        self.assertRaises(DistutilsOptionError, dist.include_feature, 'bar')
+        with pytest.raises(DistutilsOptionError):
+            dist.include_feature('bar')
 
     def testFeatureWithInvalidRemove(self):
-        self.assertRaises(
-            SystemExit, makeSetup, features = {'x':Feature('x', remove='y')}
-        )
+        with pytest.raises(SystemExit):
+            makeSetup(features={'x':Feature('x', remove='y')})
 
-class TestCommandTests(unittest.TestCase):
+class TestCommandTests:
 
     def testTestIsCommand(self):
         test_cmd = makeSetup().get_command_obj('test')
-        self.assertTrue(isinstance(test_cmd, distutils.cmd.Command))
+        assert (isinstance(test_cmd, distutils.cmd.Command))
 
     def testLongOptSuiteWNoDefault(self):
         ts1 = makeSetup(script_args=['test','--test-suite=foo.tests.suite'])
         ts1 = ts1.get_command_obj('test')
         ts1.ensure_finalized()
-        self.assertEqual(ts1.test_suite, 'foo.tests.suite')
+        assert ts1.test_suite == 'foo.tests.suite'
 
     def testDefaultSuite(self):
         ts2 = makeSetup(test_suite='bar.tests.suite').get_command_obj('test')
         ts2.ensure_finalized()
-        self.assertEqual(ts2.test_suite, 'bar.tests.suite')
+        assert ts2.test_suite == 'bar.tests.suite'
 
     def testDefaultWModuleOnCmdLine(self):
         ts3 = makeSetup(
@@ -321,16 +307,17 @@ class TestCommandTests(unittest.TestCase):
             script_args=['test','-m','foo.tests']
         ).get_command_obj('test')
         ts3.ensure_finalized()
-        self.assertEqual(ts3.test_module, 'foo.tests')
-        self.assertEqual(ts3.test_suite,  'foo.tests.test_suite')
+        assert ts3.test_module == 'foo.tests'
+        assert ts3.test_suite == 'foo.tests.test_suite'
 
     def testConflictingOptions(self):
         ts4 = makeSetup(
             script_args=['test','-m','bar.tests', '-s','foo.tests.suite']
         ).get_command_obj('test')
-        self.assertRaises(DistutilsOptionError, ts4.ensure_finalized)
+        with pytest.raises(DistutilsOptionError):
+            ts4.ensure_finalized()
 
     def testNoSuite(self):
         ts5 = makeSetup().get_command_obj('test')
         ts5.ensure_finalized()
-        self.assertEqual(ts5.test_suite, None)
+        assert ts5.test_suite == None
-- 
cgit v1.2.1


From 8e8467a5abcaf920184dd07f6e0c092989aa12ff Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:23:39 -0500
Subject: Convert test_dist_info to pytest form

---
 setuptools/tests/test_dist_info.py | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index a8adb68c..5f3b5952 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -3,23 +3,17 @@
 import os
 import shutil
 import tempfile
-import unittest
 import textwrap
 
-try:
-    import ast
-except:
-    pass
+import pytest
 
 import pkg_resources
 
-from setuptools.tests.py26compat import skipIf
-
 def DALS(s):
     "dedent and left-strip"
     return textwrap.dedent(s).lstrip()
 
-class TestDistInfo(unittest.TestCase):
+class TestDistInfo:
 
     def test_distinfo(self):
         dists = {}
@@ -34,18 +28,17 @@ class TestDistInfo(unittest.TestCase):
         assert versioned.version == '2.718' # from filename
         assert unversioned.version == '0.3' # from METADATA
 
-    @skipIf('ast' not in globals(),
-        "ast is used to test conditional dependencies (Python >= 2.6)")
+    @pytest.mark.importorskip('ast')
     def test_conditional_dependencies(self):
         requires = [pkg_resources.Requirement.parse('splort==4'),
                     pkg_resources.Requirement.parse('quux>=1.1')]
 
         for d in pkg_resources.find_distributions(self.tmpdir):
-            self.assertEqual(d.requires(), requires[:1])
-            self.assertEqual(d.requires(extras=('baz',)), requires)
-            self.assertEqual(d.extras, ['baz'])
+            assert d.requires() == requires[:1]
+            assert d.requires(extras=('baz',)) == requires
+            assert d.extras == ['baz']
 
-    def setUp(self):
+    def setup_method(self, method):
         self.tmpdir = tempfile.mkdtemp()
         versioned = os.path.join(self.tmpdir,
                                  'VersionedDistribution-2.718.dist-info')
@@ -79,5 +72,5 @@ class TestDistInfo(unittest.TestCase):
         finally:
             metadata_file.close()
 
-    def tearDown(self):
+    def teardown_method(self, method):
         shutil.rmtree(self.tmpdir)
-- 
cgit v1.2.1


From a476eca3548d454b7b9589f4e10c91c17e491c1f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:26:19 -0500
Subject: Use contexts for opening files

---
 setuptools/tests/test_dist_info.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 5f3b5952..812e6c46 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -43,8 +43,7 @@ class TestDistInfo:
         versioned = os.path.join(self.tmpdir,
                                  'VersionedDistribution-2.718.dist-info')
         os.mkdir(versioned)
-        metadata_file = open(os.path.join(versioned, 'METADATA'), 'w+')
-        try:
+        with open(os.path.join(versioned, 'METADATA'), 'w+') as metadata_file:
             metadata_file.write(DALS(
                 """
                 Metadata-Version: 1.2
@@ -53,13 +52,10 @@ class TestDistInfo:
                 Provides-Extra: baz
                 Requires-Dist: quux (>=1.1); extra == 'baz'
                 """))
-        finally:
-            metadata_file.close()
         unversioned = os.path.join(self.tmpdir,
                                    'UnversionedDistribution.dist-info')
         os.mkdir(unversioned)
-        metadata_file = open(os.path.join(unversioned, 'METADATA'), 'w+')
-        try:
+        with open(os.path.join(unversioned, 'METADATA'), 'w+') as metadata_file:
             metadata_file.write(DALS(
                 """
                 Metadata-Version: 1.2
@@ -69,8 +65,6 @@ class TestDistInfo:
                 Provides-Extra: baz
                 Requires-Dist: quux (>=1.1); extra == 'baz'
                 """))
-        finally:
-            metadata_file.close()
 
     def teardown_method(self, method):
         shutil.rmtree(self.tmpdir)
-- 
cgit v1.2.1


From ef3ee2cfee65f99d320983cbf6e32448b2cefbbe Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:34:23 -0500
Subject: Extract commonality of metadata template.

---
 setuptools/tests/test_dist_info.py | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 812e6c46..91195c52 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -38,33 +38,36 @@ class TestDistInfo:
             assert d.requires(extras=('baz',)) == requires
             assert d.extras == ['baz']
 
+    metadata_template = DALS("""
+        Metadata-Version: 1.2
+        Name: {name}
+        {version}
+        Requires-Dist: splort (==4)
+        Provides-Extra: baz
+        Requires-Dist: quux (>=1.1); extra == 'baz'
+        """)
+
     def setup_method(self, method):
         self.tmpdir = tempfile.mkdtemp()
         versioned = os.path.join(self.tmpdir,
                                  'VersionedDistribution-2.718.dist-info')
         os.mkdir(versioned)
         with open(os.path.join(versioned, 'METADATA'), 'w+') as metadata_file:
-            metadata_file.write(DALS(
-                """
-                Metadata-Version: 1.2
-                Name: VersionedDistribution
-                Requires-Dist: splort (4)
-                Provides-Extra: baz
-                Requires-Dist: quux (>=1.1); extra == 'baz'
-                """))
+            metadata = self.metadata_template.format(
+                name='VersionedDistribution',
+                version='',
+            ).replace('\n\n', '\n')
+            metadata = metadata.replace('==4', '4')
+            metadata_file.write(metadata)
         unversioned = os.path.join(self.tmpdir,
                                    'UnversionedDistribution.dist-info')
         os.mkdir(unversioned)
         with open(os.path.join(unversioned, 'METADATA'), 'w+') as metadata_file:
-            metadata_file.write(DALS(
-                """
-                Metadata-Version: 1.2
-                Name: UnversionedDistribution
-                Version: 0.3
-                Requires-Dist: splort (==4)
-                Provides-Extra: baz
-                Requires-Dist: quux (>=1.1); extra == 'baz'
-                """))
+            metadata = self.metadata_template.format(
+                name='UnversionedDistribution',
+                version='Version: 0.3',
+            )
+            metadata_file.write(metadata)
 
     def teardown_method(self, method):
         shutil.rmtree(self.tmpdir)
-- 
cgit v1.2.1


From 600992dff64b3aefe0061b9861a48cf3558adcdc Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:34:47 -0500
Subject: I'm pretty sure this deviance was incidental.

---
 setuptools/tests/test_dist_info.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 91195c52..edf3ffff 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -57,7 +57,6 @@ class TestDistInfo:
                 name='VersionedDistribution',
                 version='',
             ).replace('\n\n', '\n')
-            metadata = metadata.replace('==4', '4')
             metadata_file.write(metadata)
         unversioned = os.path.join(self.tmpdir,
                                    'UnversionedDistribution.dist-info')
-- 
cgit v1.2.1


From 3d4e8cfb4339e641f65def5185bcc784f6190df5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:35:34 -0500
Subject: Extract variables to nicen indentation.

---
 setuptools/tests/test_dist_info.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index edf3ffff..ed3f1886 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -49,8 +49,8 @@ class TestDistInfo:
 
     def setup_method(self, method):
         self.tmpdir = tempfile.mkdtemp()
-        versioned = os.path.join(self.tmpdir,
-                                 'VersionedDistribution-2.718.dist-info')
+        dist_info_name = 'VersionedDistribution-2.718.dist-info'
+        versioned = os.path.join(self.tmpdir, dist_info_name)
         os.mkdir(versioned)
         with open(os.path.join(versioned, 'METADATA'), 'w+') as metadata_file:
             metadata = self.metadata_template.format(
@@ -58,8 +58,8 @@ class TestDistInfo:
                 version='',
             ).replace('\n\n', '\n')
             metadata_file.write(metadata)
-        unversioned = os.path.join(self.tmpdir,
-                                   'UnversionedDistribution.dist-info')
+        dist_info_name = 'UnversionedDistribution.dist-info'
+        unversioned = os.path.join(self.tmpdir, dist_info_name)
         os.mkdir(unversioned)
         with open(os.path.join(unversioned, 'METADATA'), 'w+') as metadata_file:
             metadata = self.metadata_template.format(
-- 
cgit v1.2.1


From 40fe6f7674b00bb6a8ed81185e938c105845a040 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:37:29 -0500
Subject: Build a dict in a generator expression.

---
 setuptools/tests/test_dist_info.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index ed3f1886..7d1247b3 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -16,9 +16,10 @@ def DALS(s):
 class TestDistInfo:
 
     def test_distinfo(self):
-        dists = {}
-        for d in pkg_resources.find_distributions(self.tmpdir):
-            dists[d.project_name] = d
+        dists = dict(
+            (d.project_name, d)
+            for d in pkg_resources.find_distributions(self.tmpdir)
+        )
 
         assert len(dists) == 2, dists
 
-- 
cgit v1.2.1


From c04985bc9b29c2e181697b10059e99fc77ef532d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:38:53 -0500
Subject: Build requires using map

---
 setuptools/tests/test_dist_info.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 7d1247b3..eab17335 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -31,8 +31,8 @@ class TestDistInfo:
 
     @pytest.mark.importorskip('ast')
     def test_conditional_dependencies(self):
-        requires = [pkg_resources.Requirement.parse('splort==4'),
-                    pkg_resources.Requirement.parse('quux>=1.1')]
+        specs = 'splort==4', 'quux>=1.1'
+        requires = list(map(pkg_resources.Requirement.parse, specs))
 
         for d in pkg_resources.find_distributions(self.tmpdir):
             assert d.requires() == requires[:1]
-- 
cgit v1.2.1


From 4f9b50728ae8c5cf81b13b2d4fd3098b9f18dfb1 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:48:11 -0500
Subject: Use pytest for skips

---
 setuptools/tests/py26compat.py         | 14 -------------
 setuptools/tests/test_find_packages.py |  5 +++--
 setuptools/tests/test_markerlib.py     | 36 +++++++++++++++-------------------
 setuptools/tests/test_resources.py     |  7 ++++---
 setuptools/tests/test_sdist.py         |  8 +++++---
 5 files changed, 28 insertions(+), 42 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index b1ffa877..c53b4809 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -1,21 +1,7 @@
 import sys
-import unittest
 import tarfile
 import contextlib
 
-try:
-	# provide skipIf for Python 2.4-2.6
-	skipIf = unittest.skipIf
-except AttributeError:
-	def skipIf(condition, reason):
-		def skipper(func):
-			def skip(*args, **kwargs):
-				return
-			if condition:
-				return skip
-			return func
-		return skipper
-
 def _tarfile_open_ex(*args, **kwargs):
 	"""
 	Extend result as a context manager.
diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py
index fe390728..50513a69 100644
--- a/setuptools/tests/test_find_packages.py
+++ b/setuptools/tests/test_find_packages.py
@@ -6,9 +6,10 @@ import tempfile
 import unittest
 import platform
 
+import pytest
+
 import setuptools
 from setuptools import find_packages
-from setuptools.tests.py26compat import skipIf
 
 find_420_packages = setuptools.PEP420PackageFinder.find
 
@@ -123,7 +124,7 @@ class TestFindPackages(unittest.TestCase):
         packages = find_packages(self.dist_dir)
         self.assertTrue('build.pkg' not in packages)
 
-    @skipIf(not has_symlink(), 'Symlink support required')
+    @pytest.mark.skipif(not has_symlink(), reason='Symlink support required')
     def test_symlinked_packages_are_included(self):
         """
         A symbolically-linked directory should be treated like any other
diff --git a/setuptools/tests/test_markerlib.py b/setuptools/tests/test_markerlib.py
index dae71cba..0cb9e70a 100644
--- a/setuptools/tests/test_markerlib.py
+++ b/setuptools/tests/test_markerlib.py
@@ -1,23 +1,19 @@
 import os
 import unittest
-from setuptools.tests.py26compat import skipIf
 
-try:
-    import ast
-except ImportError:
-    pass
+import pytest
+
 
 class TestMarkerlib(unittest.TestCase):
 
-    @skipIf('ast' not in globals(),
-        "ast not available (Python < 2.6?)")
+    @pytest.mark.importorskip('ast')
     def test_markers(self):
         from _markerlib import interpret, default_environment, compile
-        
+
         os_name = os.name
-        
+
         self.assertTrue(interpret(""))
-        
+
         self.assertTrue(interpret("os.name != 'buuuu'"))
         self.assertTrue(interpret("os_name != 'buuuu'"))
         self.assertTrue(interpret("python_version > '1.0'"))
@@ -27,7 +23,7 @@ class TestMarkerlib(unittest.TestCase):
         self.assertTrue(interpret("'%s' in os.name" % os_name))
         self.assertTrue(interpret("'%s' in os_name" % os_name))
         self.assertTrue(interpret("'buuuu' not in os.name"))
-        
+
         self.assertFalse(interpret("os.name == 'buuuu'"))
         self.assertFalse(interpret("os_name == 'buuuu'"))
         self.assertFalse(interpret("python_version < '1.0'"))
@@ -35,14 +31,14 @@ class TestMarkerlib(unittest.TestCase):
         self.assertFalse(interpret("python_version >= '5.0'"))
         self.assertFalse(interpret("python_version <= '1.0'"))
         self.assertFalse(interpret("'%s' not in os.name" % os_name))
-        self.assertFalse(interpret("'buuuu' in os.name and python_version >= '5.0'"))    
-        self.assertFalse(interpret("'buuuu' in os_name and python_version >= '5.0'"))    
-        
+        self.assertFalse(interpret("'buuuu' in os.name and python_version >= '5.0'"))
+        self.assertFalse(interpret("'buuuu' in os_name and python_version >= '5.0'"))
+
         environment = default_environment()
         environment['extra'] = 'test'
         self.assertTrue(interpret("extra == 'test'", environment))
         self.assertFalse(interpret("extra == 'doc'", environment))
-        
+
         def raises_nameError():
             try:
                 interpret("python.version == '42'")
@@ -50,9 +46,9 @@ class TestMarkerlib(unittest.TestCase):
                 pass
             else:
                 raise Exception("Expected NameError")
-        
+
         raises_nameError()
-        
+
         def raises_syntaxError():
             try:
                 interpret("(x for x in (4,))")
@@ -60,9 +56,9 @@ class TestMarkerlib(unittest.TestCase):
                 pass
             else:
                 raise Exception("Expected SyntaxError")
-            
+
         raises_syntaxError()
-        
+
         statement = "python_version == '5'"
         self.assertEqual(compile(statement).__doc__, statement)
-        
+
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index f9f2e459..ba8835a9 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -8,6 +8,8 @@ import tempfile
 import shutil
 from unittest import TestCase
 
+import pytest
+
 import pkg_resources
 from pkg_resources import (parse_requirements, VersionConflict, parse_version,
     Distribution, EntryPoint, Requirement, safe_version, safe_name,
@@ -18,7 +20,6 @@ packaging = pkg_resources.packaging
 from setuptools.command.easy_install import (get_script_header, is_sh,
     nt_quote_arg)
 from setuptools.compat import StringIO, iteritems, PY3
-from .py26compat import skipIf
 
 def safe_repr(obj, short=False):
     """ copied from Python2.7"""
@@ -612,8 +613,8 @@ class NamespaceTests(TestCase):
         pkg_resources._namespace_packages = self._ns_pkgs.copy()
         sys.path = self._prev_sys_path[:]
 
-    msg = "Test fails when /tmp is a symlink. See #231"
-    @skipIf(os.path.islink(tempfile.gettempdir()), msg)
+    @pytest.mark.skipif(os.path.islink(tempfile.gettempdir()),
+        reason="Test fails when /tmp is a symlink. See #231")
     def test_two_levels_deep(self):
         """
         Test nested namespace packages
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 123e3ea9..120911d2 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -9,7 +9,8 @@ import tempfile
 import unittest
 import unicodedata
 import contextlib
-from setuptools.tests.py26compat import skipIf
+
+import pytest
 
 import pkg_resources
 from setuptools.compat import StringIO, unicode, PY3, PY2
@@ -336,8 +337,9 @@ class TestSdistTest(unittest.TestCase):
             filename = filename.decode('latin-1')
             self.assertFalse(filename in cmd.filelist.files)
 
-    @skipIf(PY3 and locale.getpreferredencoding() != 'UTF-8',
-            'Unittest fails if locale is not utf-8 but the manifests is recorded correctly')
+    @pytest.mark.skipif(PY3 and locale.getpreferredencoding() != 'UTF-8',
+        reason='Unittest fails if locale is not utf-8 but the manifests is '
+            'recorded correctly')
     def test_sdist_with_utf8_encoded_filename(self):
         # Test for #303.
         dist = Distribution(SETUP_ATTRS)
-- 
cgit v1.2.1


From b2d5b933ca507817db94e58bf0fb3e7d20ae12f2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 16:56:53 -0500
Subject: Remove unused imports

---
 setuptools/tests/test_packageindex.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 664566a3..d1d6ca8d 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -4,7 +4,7 @@ import sys
 import os
 import unittest
 import pkg_resources
-from setuptools.compat import urllib2, httplib, HTTPError, unicode, pathname2url
+from setuptools.compat import httplib, HTTPError, unicode, pathname2url
 import distutils.errors
 import setuptools.package_index
 from setuptools.tests.server import IndexServer
-- 
cgit v1.2.1


From ed54215c1ca6be3874ad8d861b8514dc3009bbb4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:02:09 -0500
Subject: Use serve_forever and shutdown, now available.

---
 setuptools/tests/server.py | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py
index ae2381e3..266ee5bd 100644
--- a/setuptools/tests/server.py
+++ b/setuptools/tests/server.py
@@ -23,12 +23,8 @@ class IndexServer(HTTPServer):
         HTTPServer.__init__(self, server_address, RequestHandlerClass)
         self._run = True
 
-    def serve(self):
-        while self._run:
-            self.handle_request()
-
     def start(self):
-        self.thread = threading.Thread(target=self.serve)
+        self.thread = threading.Thread(target=self.serve_forever)
         self.thread.start()
 
     def stop(self):
@@ -37,19 +33,7 @@ class IndexServer(HTTPServer):
         # Let the server finish the last request and wait for a new one.
         time.sleep(0.1)
 
-        # self.shutdown is not supported on python < 2.6, so just
-        #  set _run to false, and make a request, causing it to
-        #  terminate.
-        self._run = False
-        url = 'http://127.0.0.1:%(server_port)s/' % vars(self)
-        try:
-            if sys.version_info >= (2, 6):
-                urllib2.urlopen(url, timeout=5)
-            else:
-                urllib2.urlopen(url)
-        except URLError:
-            # ignore any errors; all that's important is the request
-            pass
+        self.shutdown()
         self.thread.join()
         self.socket.close()
 
-- 
cgit v1.2.1


From 9f6d874dfc15a4d695dbed3ffa9bd3ed56008350 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:03:21 -0500
Subject: Use property

---
 setuptools/tests/server.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py
index 266ee5bd..b53168d1 100644
--- a/setuptools/tests/server.py
+++ b/setuptools/tests/server.py
@@ -61,6 +61,6 @@ class MockServer(HTTPServer, threading.Thread):
     def run(self):
         self.serve_forever()
 
+    @property
     def url(self):
         return 'http://localhost:%(server_port)s/' % vars(self)
-    url = property(url)
-- 
cgit v1.2.1


From d4411774ba9ee79480c8128b4e8f610481a65cf3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:03:42 -0500
Subject: Remove unused imports

---
 setuptools/tests/server.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py
index b53168d1..6b214279 100644
--- a/setuptools/tests/server.py
+++ b/setuptools/tests/server.py
@@ -1,11 +1,10 @@
 """Basic http server for tests to simulate PyPI or custom indexes
 """
-import sys
+
 import time
 import threading
 from setuptools.compat import BaseHTTPRequestHandler
-from setuptools.compat import (urllib2, URLError, HTTPServer,
-                               SimpleHTTPRequestHandler)
+from setuptools.compat import HTTPServer, SimpleHTTPRequestHandler
 
 class IndexServer(HTTPServer):
     """Basic single-threaded http server simulating a package index
-- 
cgit v1.2.1


From 64a1da4d9c2e85d28e9c4040bcccb5abbdd689ce Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:05:55 -0500
Subject: Remove unused imports

---
 setuptools/tests/test_bdist_egg.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index cf4bcd11..208f63dd 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -8,10 +8,7 @@ import sys
 import tempfile
 import unittest
 
-from distutils.errors import DistutilsError
 from setuptools.compat import StringIO
-from setuptools.command.bdist_egg import bdist_egg
-from setuptools.command import easy_install as easy_install_pkg
 from setuptools.dist import Distribution
 
 SETUP_PY = """\
@@ -56,7 +53,7 @@ class TestDevelopTest(unittest.TestCase):
             ))
         os.makedirs(os.path.join('build', 'src'))
         old_stdout = sys.stdout
-        sys.stdout = o = StringIO()
+        sys.stdout = StringIO()
         try:
             dist.parse_command_line()
             dist.run_commands()
-- 
cgit v1.2.1


From 189b1c027e626496b7b7bb1b5996123f54286075 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:06:47 -0500
Subject: Use context opener

---
 setuptools/tests/test_bdist_egg.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 208f63dd..58d25b70 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -23,12 +23,10 @@ class TestDevelopTest(unittest.TestCase):
         self.dir = tempfile.mkdtemp()
         self.old_cwd = os.getcwd()
         os.chdir(self.dir)
-        f = open('setup.py', 'w')
-        f.write(SETUP_PY)
-        f.close()
-        f = open('hi.py', 'w')
-        f.write('1\n')
-        f.close()
+        with open('setup.py', 'w') as f:
+            f.write(SETUP_PY)
+        with open('hi.py', 'w') as f:
+            f.write('1\n')
         if sys.version >= "2.6":
             self.old_base = site.USER_BASE
             site.USER_BASE = tempfile.mkdtemp()
-- 
cgit v1.2.1


From 0bc8f31f5d694578cec3d0b8b4951db06fc921fb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:10:57 -0500
Subject: Move contexts to their own module

---
 setuptools/tests/contexts.py          | 59 ++++++++++++++++++++++++++++++
 setuptools/tests/test_easy_install.py | 69 +++++------------------------------
 2 files changed, 69 insertions(+), 59 deletions(-)
 create mode 100644 setuptools/tests/contexts.py

(limited to 'setuptools')

diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py
new file mode 100644
index 00000000..a9626ae6
--- /dev/null
+++ b/setuptools/tests/contexts.py
@@ -0,0 +1,59 @@
+import tempfile
+import os
+import shutil
+import sys
+import contextlib
+
+from ..compat import StringIO
+
+
+@contextlib.contextmanager
+def tempdir(cd=lambda dir:None):
+    temp_dir = tempfile.mkdtemp()
+    orig_dir = os.getcwd()
+    try:
+        cd(temp_dir)
+        yield temp_dir
+    finally:
+        cd(orig_dir)
+        shutil.rmtree(temp_dir)
+
+
+@contextlib.contextmanager
+def environment(**updates):
+    old_env = os.environ.copy()
+    os.environ.update(updates)
+    try:
+        yield
+    finally:
+        for key in updates:
+            del os.environ[key]
+        os.environ.update(old_env)
+
+
+@contextlib.contextmanager
+def argv(repl):
+    old_argv = sys.argv[:]
+    sys.argv[:] = repl
+    yield
+    sys.argv[:] = old_argv
+
+
+@contextlib.contextmanager
+def quiet():
+    """
+    Redirect stdout/stderr to StringIO objects to prevent console output from
+    distutils commands.
+    """
+
+    old_stdout = sys.stdout
+    old_stderr = sys.stderr
+    new_stdout = sys.stdout = StringIO()
+    new_stderr = sys.stderr = StringIO()
+    try:
+        yield new_stdout, new_stderr
+    finally:
+        new_stdout.seek(0)
+        new_stderr.seek(0)
+        sys.stdout = old_stdout
+        sys.stderr = old_stderr
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 46c2df2c..19e1674c 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -29,6 +29,7 @@ import setuptools.tests.server
 import pkg_resources
 
 from .py26compat import tarfile_open
+from . import contexts
 
 
 def DALS(input):
@@ -264,7 +265,7 @@ class TestUserInstallTest(unittest.TestCase):
         test_setup_py = os.path.join(test_pkg, 'setup.py')
 
         try:
-            with quiet_context():
+            with contexts.quiet():
                 with self.patched_setup_context():
                     run_setup(test_setup_py, ['install'])
         except SandboxViolation:
@@ -281,7 +282,7 @@ def distutils_package():
         'from setuptools import setup',
         'from distutils.core import setup',
     )
-    with tempdir_context(cd=os.chdir):
+    with contexts.tempdir(cd=os.chdir):
         with open('setup.py', 'w') as f:
             f.write(distutils_setup_py)
         yield
@@ -309,11 +310,11 @@ class TestSetupRequires(unittest.TestCase):
             # Some platforms (Jython) don't find a port to which to bind,
             #  so skip this test for them.
             return
-        with quiet_context():
+        with contexts.quiet():
             # create an sdist that has a build-time dependency.
             with TestSetupRequires.create_sdist() as dist_file:
-                with tempdir_context() as temp_install_dir:
-                    with environment_context(PYTHONPATH=temp_install_dir):
+                with contexts.tempdir() as temp_install_dir:
+                    with contexts.environment(PYTHONPATH=temp_install_dir):
                         ei_params = [
                             '--index-url', p_index.url,
                             '--allow-hosts', p_index_loc,
@@ -321,7 +322,7 @@ class TestSetupRequires(unittest.TestCase):
                             '--install-dir', temp_install_dir,
                             dist_file,
                         ]
-                        with argv_context(['easy_install']):
+                        with contexts.argv(['easy_install']):
                             # attempt to install the dist. It should fail because
                             #  it doesn't exist.
                             with pytest.raises(SystemExit):
@@ -338,7 +339,7 @@ class TestSetupRequires(unittest.TestCase):
         Return an sdist with a setup_requires dependency (of something that
         doesn't exist)
         """
-        with tempdir_context() as dir:
+        with contexts.tempdir() as dir:
             dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
             script = DALS("""
                 import setuptools
@@ -366,10 +367,10 @@ class TestSetupRequires(unittest.TestCase):
         working_set.add(fake_dist)
 
         try:
-            with tempdir_context() as temp_dir:
+            with contexts.tempdir() as temp_dir:
                 test_pkg = create_setup_requires_package(temp_dir)
                 test_setup_py = os.path.join(test_pkg, 'setup.py')
-                with quiet_context() as (stdout, stderr):
+                with contexts.quiet() as (stdout, stderr):
                     try:
                         # Don't even need to install the package, just
                         # running the setup.py at all is sufficient
@@ -436,53 +437,3 @@ def make_trivial_sdist(dist_path, setup_py):
     setup_py_file.size = len(setup_py_bytes.getvalue())
     with tarfile_open(dist_path, 'w:gz') as dist:
         dist.addfile(setup_py_file, fileobj=setup_py_bytes)
-
-
-@contextlib.contextmanager
-def tempdir_context(cd=lambda dir:None):
-    temp_dir = tempfile.mkdtemp()
-    orig_dir = os.getcwd()
-    try:
-        cd(temp_dir)
-        yield temp_dir
-    finally:
-        cd(orig_dir)
-        shutil.rmtree(temp_dir)
-
-@contextlib.contextmanager
-def environment_context(**updates):
-    old_env = os.environ.copy()
-    os.environ.update(updates)
-    try:
-        yield
-    finally:
-        for key in updates:
-            del os.environ[key]
-        os.environ.update(old_env)
-
-@contextlib.contextmanager
-def argv_context(repl):
-    old_argv = sys.argv[:]
-    sys.argv[:] = repl
-    yield
-    sys.argv[:] = old_argv
-
-
-@contextlib.contextmanager
-def quiet_context():
-    """
-    Redirect stdout/stderr to StringIO objects to prevent console output from
-    distutils commands.
-    """
-
-    old_stdout = sys.stdout
-    old_stderr = sys.stderr
-    new_stdout = sys.stdout = StringIO()
-    new_stderr = sys.stderr = StringIO()
-    try:
-        yield new_stdout, new_stderr
-    finally:
-        new_stdout.seek(0)
-        new_stderr.seek(0)
-        sys.stdout = old_stdout
-        sys.stderr = old_stderr
-- 
cgit v1.2.1


From 32f39a11f9196984c50b2193ca40c2472040ed96 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:14:19 -0500
Subject: Use quiet context instead of copy pasta.

---
 setuptools/tests/test_bdist_egg.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 58d25b70..519f27c9 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -8,9 +8,11 @@ import sys
 import tempfile
 import unittest
 
-from setuptools.compat import StringIO
 from setuptools.dist import Distribution
 
+from . import contexts
+
+
 SETUP_PY = """\
 from setuptools import setup
 
@@ -50,13 +52,9 @@ class TestDevelopTest(unittest.TestCase):
             py_modules=['hi']
             ))
         os.makedirs(os.path.join('build', 'src'))
-        old_stdout = sys.stdout
-        sys.stdout = StringIO()
-        try:
+        with contexts.quiet():
             dist.parse_command_line()
             dist.run_commands()
-        finally:
-            sys.stdout = old_stdout
 
         # let's see if we got our egg link at the right place
         [content] = os.listdir('dist')
-- 
cgit v1.2.1


From ae7007467caf6d29936c0e7ff9f9d92f610aeb98 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:14:41 -0500
Subject: Python 2.6 is required

---
 setuptools/tests/test_bdist_egg.py | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 519f27c9..1b406f5c 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -4,7 +4,6 @@ import os
 import re
 import shutil
 import site
-import sys
 import tempfile
 import unittest
 
@@ -29,20 +28,18 @@ class TestDevelopTest(unittest.TestCase):
             f.write(SETUP_PY)
         with open('hi.py', 'w') as f:
             f.write('1\n')
-        if sys.version >= "2.6":
-            self.old_base = site.USER_BASE
-            site.USER_BASE = tempfile.mkdtemp()
-            self.old_site = site.USER_SITE
-            site.USER_SITE = tempfile.mkdtemp()
+        self.old_base = site.USER_BASE
+        site.USER_BASE = tempfile.mkdtemp()
+        self.old_site = site.USER_SITE
+        site.USER_SITE = tempfile.mkdtemp()
 
     def tearDown(self):
         os.chdir(self.old_cwd)
         shutil.rmtree(self.dir)
-        if sys.version >= "2.6":
-            shutil.rmtree(site.USER_BASE)
-            shutil.rmtree(site.USER_SITE)
-            site.USER_BASE = self.old_base
-            site.USER_SITE = self.old_site
+        shutil.rmtree(site.USER_BASE)
+        shutil.rmtree(site.USER_SITE)
+        site.USER_BASE = self.old_base
+        site.USER_SITE = self.old_site
 
     def test_bdist_egg(self):
         dist = Distribution(dict(
-- 
cgit v1.2.1


From 1cbdf581186e1f34f1e48673f5faf60922e66799 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:31:37 -0500
Subject: Replace setup and teardown with pytest fixtures.

---
 setuptools/tests/test_bdist_egg.py | 62 ++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 33 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 1b406f5c..d29ef441 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -2,10 +2,9 @@
 """
 import os
 import re
-import shutil
-import site
-import tempfile
-import unittest
+
+import pytest
+import mock
 
 from setuptools.dist import Distribution
 
@@ -18,30 +17,31 @@ from setuptools import setup
 setup(name='foo', py_modules=['hi'])
 """
 
-class TestDevelopTest(unittest.TestCase):
-
-    def setUp(self):
-        self.dir = tempfile.mkdtemp()
-        self.old_cwd = os.getcwd()
-        os.chdir(self.dir)
-        with open('setup.py', 'w') as f:
-            f.write(SETUP_PY)
-        with open('hi.py', 'w') as f:
-            f.write('1\n')
-        self.old_base = site.USER_BASE
-        site.USER_BASE = tempfile.mkdtemp()
-        self.old_site = site.USER_SITE
-        site.USER_SITE = tempfile.mkdtemp()
-
-    def tearDown(self):
-        os.chdir(self.old_cwd)
-        shutil.rmtree(self.dir)
-        shutil.rmtree(site.USER_BASE)
-        shutil.rmtree(site.USER_SITE)
-        site.USER_BASE = self.old_base
-        site.USER_SITE = self.old_site
-
-    def test_bdist_egg(self):
+@pytest.yield_fixture
+def user_override():
+    """
+    Override site.USER_BASE and site.USER_SITE with temporary directories in
+    a context.
+    """
+    with contexts.tempdir() as user_base:
+        with mock.patch('site.USER_BASE', user_base):
+            with contexts.tempdir() as user_site:
+                with mock.patch('site.USER_SITE', user_site):
+                    yield
+
+
+@pytest.yield_fixture
+def setup_context(tmpdir):
+    with (tmpdir/'setup.py').open('w') as f:
+        f.write(SETUP_PY)
+    with (tmpdir/'hi.py').open('w') as f:
+        f.write('1\n')
+    with tmpdir.as_cwd():
+        yield tmpdir
+
+
+class TestDevelopTest:
+    def test_bdist_egg(self, setup_context, user_override):
         dist = Distribution(dict(
             script_name='setup.py',
             script_args=['bdist_egg'],
@@ -55,8 +55,4 @@ class TestDevelopTest(unittest.TestCase):
 
         # let's see if we got our egg link at the right place
         [content] = os.listdir('dist')
-        self.assertTrue(re.match('foo-0.0.0-py[23].\d.egg$', content))
-
-def test_suite():
-    return unittest.makeSuite(TestDevelopTest)
-
+        assert re.match('foo-0.0.0-py[23].\d.egg$', content)
-- 
cgit v1.2.1


From 0003313ff59f74efe21893a7278c5e89ba58afea Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:33:02 -0500
Subject: Correct naming artifact.

---
 setuptools/tests/test_bdist_egg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index d29ef441..08bc75d7 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -40,7 +40,7 @@ def setup_context(tmpdir):
         yield tmpdir
 
 
-class TestDevelopTest:
+class Test:
     def test_bdist_egg(self, setup_context, user_override):
         dist = Distribution(dict(
             script_name='setup.py',
-- 
cgit v1.2.1


From 903c0d6a3bda96a0b193cc6efd2f8e868d4d82e2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:35:05 -0500
Subject: Use namespacing for easier reading

---
 setuptools/tests/test_build_ext.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index a92e53ae..32e4ad40 100644
--- a/setuptools/tests/test_build_ext.py
+++ b/setuptools/tests/test_build_ext.py
@@ -1,7 +1,8 @@
 """build_ext tests
 """
 import unittest
-from distutils.command.build_ext import build_ext as distutils_build_ext
+import distutils.command.build_ext as orig
+
 from setuptools.command.build_ext import build_ext
 from setuptools.dist import Distribution
 
@@ -15,5 +16,5 @@ class TestBuildExtTest(unittest.TestCase):
         cmd = build_ext(dist)
         cmd.ext_map['foo/bar'] = ''
         res = cmd.get_ext_filename('foo')
-        wanted = distutils_build_ext.get_ext_filename(cmd, 'foo')
+        wanted = orig.build_ext.get_ext_filename(cmd, 'foo')
         assert res == wanted
-- 
cgit v1.2.1


From 615fc93eba554dba65b3545ead2405014e2a4af8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:35:37 -0500
Subject: Remodel comment as docstring.

---
 setuptools/tests/test_build_ext.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index 32e4ad40..cc8a35e5 100644
--- a/setuptools/tests/test_build_ext.py
+++ b/setuptools/tests/test_build_ext.py
@@ -9,9 +9,11 @@ from setuptools.dist import Distribution
 class TestBuildExtTest(unittest.TestCase):
 
     def test_get_ext_filename(self):
-        # setuptools needs to give back the same
-        # result than distutils, even if the fullname
-        # is not in ext_map
+        """
+        Setuptools needs to give back the same
+        result as distutils, even if the fullname
+        is not in ext_map.
+        """
         dist = Distribution()
         cmd = build_ext(dist)
         cmd.ext_map['foo/bar'] = ''
-- 
cgit v1.2.1


From 359a80897decd64a0d997005dc7cb731fc294133 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:36:29 -0500
Subject: Use pytest for test discovery in build_ext

---
 setuptools/tests/test_build_ext.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index cc8a35e5..3f356aca 100644
--- a/setuptools/tests/test_build_ext.py
+++ b/setuptools/tests/test_build_ext.py
@@ -1,12 +1,11 @@
 """build_ext tests
 """
-import unittest
 import distutils.command.build_ext as orig
 
 from setuptools.command.build_ext import build_ext
 from setuptools.dist import Distribution
 
-class TestBuildExtTest(unittest.TestCase):
+class TestBuildExt:
 
     def test_get_ext_filename(self):
         """
-- 
cgit v1.2.1


From 64a3d8b243a2c41dc43b29567652518f1b08992d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 17:36:49 -0500
Subject: Remove superfluous comment

---
 setuptools/tests/test_build_ext.py | 3 ---
 1 file changed, 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index 3f356aca..0719ba44 100644
--- a/setuptools/tests/test_build_ext.py
+++ b/setuptools/tests/test_build_ext.py
@@ -1,12 +1,9 @@
-"""build_ext tests
-"""
 import distutils.command.build_ext as orig
 
 from setuptools.command.build_ext import build_ext
 from setuptools.dist import Distribution
 
 class TestBuildExt:
-
     def test_get_ext_filename(self):
         """
         Setuptools needs to give back the same
-- 
cgit v1.2.1


From 0ef90459f8c249a53a0c5e9daaa8a4cf407f7fe9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 18:09:36 -0500
Subject: Convert test_develop to use pytest

---
 setuptools/tests/test_develop.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index 66d182eb..9d8a56c3 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -5,7 +5,6 @@ import shutil
 import site
 import sys
 import tempfile
-import unittest
 
 from distutils.errors import DistutilsError
 from setuptools.command.develop import develop
@@ -23,9 +22,9 @@ setup(name='foo',
 INIT_PY = """print "foo"
 """
 
-class TestDevelopTest(unittest.TestCase):
+class TestDevelopTest:
 
-    def setUp(self):
+    def setup_method(self, method):
         if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
             return
 
@@ -50,7 +49,7 @@ class TestDevelopTest(unittest.TestCase):
         self.old_site = site.USER_SITE
         site.USER_SITE = tempfile.mkdtemp()
 
-    def tearDown(self):
+    def teardown_method(self, method):
         if sys.version < "2.6" or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
             return
 
@@ -86,7 +85,7 @@ class TestDevelopTest(unittest.TestCase):
         # let's see if we got our egg link at the right place
         content = os.listdir(site.USER_SITE)
         content.sort()
-        self.assertEqual(content, ['easy-install.pth', 'foo.egg-link'])
+        assert content == ['easy-install.pth', 'foo.egg-link']
 
         # Check that we are using the right code.
         egg_link_file = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt')
@@ -100,9 +99,9 @@ class TestDevelopTest(unittest.TestCase):
         finally:
             init_file.close()
         if sys.version < "3":
-            self.assertEqual(init, 'print "foo"')
+            assert init == 'print "foo"'
         else:
-            self.assertEqual(init, 'print("foo")')
+            assert init == 'print("foo")'
 
     def notest_develop_with_setup_requires(self):
 
-- 
cgit v1.2.1


From a5b9b91081943cb771a3fc7b5873410599513332 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 18:12:40 -0500
Subject: Remove consideration for older Pythons

---
 setuptools/tests/test_develop.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index 9d8a56c3..890880dc 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -25,7 +25,7 @@ INIT_PY = """print "foo"
 class TestDevelopTest:
 
     def setup_method(self, method):
-        if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
+        if hasattr(sys, 'real_prefix'):
             return
 
         # Directory structure
@@ -50,7 +50,7 @@ class TestDevelopTest:
         site.USER_SITE = tempfile.mkdtemp()
 
     def teardown_method(self, method):
-        if sys.version < "2.6" or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
+        if hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
             return
 
         os.chdir(self.old_cwd)
@@ -61,7 +61,7 @@ class TestDevelopTest:
         site.USER_SITE = self.old_site
 
     def test_develop(self):
-        if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
+        if hasattr(sys, 'real_prefix'):
             return
         dist = Distribution(
             dict(name='foo',
-- 
cgit v1.2.1


From c3319da5b2e4a8d597a5b27d4a034199eea78745 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 18:13:41 -0500
Subject: Remove apparently unused method.

---
 setuptools/tests/test_develop.py | 17 -----------------
 1 file changed, 17 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index 890880dc..f18ddd6e 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -102,20 +102,3 @@ class TestDevelopTest:
             assert init == 'print "foo"'
         else:
             assert init == 'print("foo")'
-
-    def notest_develop_with_setup_requires(self):
-
-        wanted = ("Could not find suitable distribution for "
-                  "Requirement.parse('I-DONT-EXIST')")
-        old_dir = os.getcwd()
-        os.chdir(self.dir)
-        try:
-            try:
-                Distribution({'setup_requires': ['I_DONT_EXIST']})
-            except DistutilsError:
-                e = sys.exc_info()[1]
-                error = str(e)
-                if error == wanted:
-                    pass
-        finally:
-            os.chdir(old_dir)
-- 
cgit v1.2.1


From f8285cac4b95e6b43869e27093ef04552e665681 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 23:31:22 -0500
Subject: Move fixture to a fixtures module and make that fixture available
 globally.

---
 setuptools/tests/fixtures.py       | 16 ++++++++++++++++
 setuptools/tests/test_bdist_egg.py | 15 ---------------
 2 files changed, 16 insertions(+), 15 deletions(-)
 create mode 100644 setuptools/tests/fixtures.py

(limited to 'setuptools')

diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
new file mode 100644
index 00000000..6b0e53f3
--- /dev/null
+++ b/setuptools/tests/fixtures.py
@@ -0,0 +1,16 @@
+import mock
+import pytest
+
+from . import contexts
+
+@pytest.yield_fixture
+def user_override():
+    """
+    Override site.USER_BASE and site.USER_SITE with temporary directories in
+    a context.
+    """
+    with contexts.tempdir() as user_base:
+        with mock.patch('site.USER_BASE', user_base):
+            with contexts.tempdir() as user_site:
+                with mock.patch('site.USER_SITE', user_site):
+                    yield
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 08bc75d7..ccfb2ea7 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -4,32 +4,17 @@ import os
 import re
 
 import pytest
-import mock
 
 from setuptools.dist import Distribution
 
 from . import contexts
 
-
 SETUP_PY = """\
 from setuptools import setup
 
 setup(name='foo', py_modules=['hi'])
 """
 
-@pytest.yield_fixture
-def user_override():
-    """
-    Override site.USER_BASE and site.USER_SITE with temporary directories in
-    a context.
-    """
-    with contexts.tempdir() as user_base:
-        with mock.patch('site.USER_BASE', user_base):
-            with contexts.tempdir() as user_site:
-                with mock.patch('site.USER_SITE', user_site):
-                    yield
-
-
 @pytest.yield_fixture
 def setup_context(tmpdir):
     with (tmpdir/'setup.py').open('w') as f:
-- 
cgit v1.2.1


From 0b799319a7360bbf2497c037188217334346ba39 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 23:38:02 -0500
Subject: Convert select tests to pytest model.

---
 setuptools/tests/test_easy_install.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 19e1674c..61eb868f 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -133,9 +133,9 @@ class TestPTHFileWriter(unittest.TestCase):
         self.assertTrue(not pth.dirty)
 
 
-class TestUserInstallTest(unittest.TestCase):
+class TestUserInstallTest:
 
-    def setUp(self):
+    def setup_method(self, method):
         self.dir = tempfile.mkdtemp()
         setup = os.path.join(self.dir, 'setup.py')
         with open(setup, 'w') as f:
@@ -151,7 +151,7 @@ class TestUserInstallTest(unittest.TestCase):
         site.USER_SITE = tempfile.mkdtemp()
         easy_install_pkg.__file__ = site.USER_SITE
 
-    def tearDown(self):
+    def teardown_method(self, method):
         os.chdir(self.old_cwd)
         shutil.rmtree(self.dir)
 
@@ -170,7 +170,7 @@ class TestUserInstallTest(unittest.TestCase):
         cmd = easy_install(dist)
         cmd.args = ['py']
         cmd.ensure_finalized()
-        self.assertTrue(cmd.user, 'user should be implied')
+        assert cmd.user, 'user should be implied'
 
     def test_multiproc_atexit(self):
         try:
@@ -191,7 +191,7 @@ class TestUserInstallTest(unittest.TestCase):
         cmd = easy_install(dist)
         cmd.args = ['py']
         cmd.initialize_options()
-        self.assertFalse(cmd.user, 'NOT user should be implied')
+        assert not cmd.user, 'NOT user should be implied'
 
     def test_local_index(self):
         # make sure the local index is used
@@ -217,7 +217,7 @@ class TestUserInstallTest(unittest.TestCase):
             res = cmd.easy_install('foo')
             actual = os.path.normcase(os.path.realpath(res.location))
             expected = os.path.normcase(os.path.realpath(new_location))
-            self.assertEqual(actual, expected)
+            assert actual == expected
         finally:
             sys.path.remove(target)
             for basedir in [new_location, target, ]:
-- 
cgit v1.2.1


From bb7a25abe65fba3fa3e8ae3973321f1fedab8e37 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 23:47:12 -0500
Subject: Also save the ENABLE_USER_SITE setting in the user_override.

---
 setuptools/tests/contexts.py | 10 ++++++++++
 setuptools/tests/fixtures.py |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py
index a9626ae6..1620bdb3 100644
--- a/setuptools/tests/contexts.py
+++ b/setuptools/tests/contexts.py
@@ -3,6 +3,7 @@ import os
 import shutil
 import sys
 import contextlib
+import site
 
 from ..compat import StringIO
 
@@ -57,3 +58,12 @@ def quiet():
         new_stderr.seek(0)
         sys.stdout = old_stdout
         sys.stderr = old_stderr
+
+
+@contextlib.contextmanager
+def save_user_site_setting():
+    saved = site.ENABLE_USER_SITE
+    try:
+        yield saved
+    finally:
+        site.ENABLE_USER_SITE = saved
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index 6b0e53f3..225c2ea3 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -13,4 +13,5 @@ def user_override():
         with mock.patch('site.USER_BASE', user_base):
             with contexts.tempdir() as user_site:
                 with mock.patch('site.USER_SITE', user_site):
-                    yield
+                    with contexts.save_user_site_setting():
+                        yield
-- 
cgit v1.2.1


From 81be05c12fd45550981d1d2a8a4e452482389376 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 23:53:59 -0500
Subject: Replace some setup/teardown code with the fixture.

---
 setuptools/tests/test_easy_install.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 61eb868f..69f42d56 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -133,6 +133,7 @@ class TestPTHFileWriter(unittest.TestCase):
         self.assertTrue(not pth.dirty)
 
 
+@pytest.mark.usefixtures("user_override")
 class TestUserInstallTest:
 
     def setup_method(self, method):
@@ -143,26 +144,17 @@ class TestUserInstallTest:
         self.old_cwd = os.getcwd()
         os.chdir(self.dir)
 
-        self.old_enable_site = site.ENABLE_USER_SITE
         self.old_file = easy_install_pkg.__file__
-        self.old_base = site.USER_BASE
-        site.USER_BASE = tempfile.mkdtemp()
-        self.old_site = site.USER_SITE
-        site.USER_SITE = tempfile.mkdtemp()
         easy_install_pkg.__file__ = site.USER_SITE
 
     def teardown_method(self, method):
         os.chdir(self.old_cwd)
         shutil.rmtree(self.dir)
 
-        shutil.rmtree(site.USER_BASE)
-        shutil.rmtree(site.USER_SITE)
-        site.USER_BASE = self.old_base
-        site.USER_SITE = self.old_site
-        site.ENABLE_USER_SITE = self.old_enable_site
         easy_install_pkg.__file__ = self.old_file
 
     def test_user_install_implied(self):
+        easy_install_pkg.__file__ = site.USER_SITE
         site.ENABLE_USER_SITE = True # disabled sometimes
         #XXX: replace with something meaningfull
         dist = Distribution()
-- 
cgit v1.2.1


From e1df8f970338c1d20fca384c4258ebb01a5e6682 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 1 Jan 2015 23:54:42 -0500
Subject: Normalize whitespace

---
 setuptools/tests/test_easy_install.py | 2 --
 1 file changed, 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 69f42d56..9922716c 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -235,7 +235,6 @@ class TestUserInstallTest:
             ei.__file__ = site.USER_SITE
             yield
 
-
     def patched_setup_context(self):
         self.orig_context = sandbox.setup_context
 
@@ -244,7 +243,6 @@ class TestUserInstallTest:
             self.user_install_setup_context,
         )
 
-
     def test_setup_requires(self):
         """Regression test for Distribute issue #318
 
-- 
cgit v1.2.1


From bc030aa9e1e5822524bb3ec9b8a0213f579b7b7c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 00:02:30 -0500
Subject: Replace much of setup/teardown with another fixture.

---
 setuptools/tests/test_easy_install.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 9922716c..04a362f5 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -133,24 +133,23 @@ class TestPTHFileWriter(unittest.TestCase):
         self.assertTrue(not pth.dirty)
 
 
+@pytest.yield_fixture
+def setup_context(tmpdir):
+    with (tmpdir/'setup.py').open('w') as f:
+        f.write(SETUP_PY)
+    with tmpdir.as_cwd():
+        yield tmpdir
+
+
 @pytest.mark.usefixtures("user_override")
+@pytest.mark.usefixtures("setup_context")
 class TestUserInstallTest:
 
     def setup_method(self, method):
-        self.dir = tempfile.mkdtemp()
-        setup = os.path.join(self.dir, 'setup.py')
-        with open(setup, 'w') as f:
-            f.write(SETUP_PY)
-        self.old_cwd = os.getcwd()
-        os.chdir(self.dir)
-
         self.old_file = easy_install_pkg.__file__
         easy_install_pkg.__file__ = site.USER_SITE
 
     def teardown_method(self, method):
-        os.chdir(self.old_cwd)
-        shutil.rmtree(self.dir)
-
         easy_install_pkg.__file__ = self.old_file
 
     def test_user_install_implied(self):
@@ -251,7 +250,7 @@ class TestUserInstallTest:
         SandboxViolation.
         """
 
-        test_pkg = create_setup_requires_package(self.dir)
+        test_pkg = create_setup_requires_package(os.getcwd())
         test_setup_py = os.path.join(test_pkg, 'setup.py')
 
         try:
-- 
cgit v1.2.1


From 2a29b7359ccfa6c5dc99a08d0a19e1c3ba1dfa5c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 00:09:56 -0500
Subject: Replace remaining setup/teardown with a simple mock.

---
 setuptools/tests/test_easy_install.py | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 04a362f5..e052ff1e 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -145,13 +145,7 @@ def setup_context(tmpdir):
 @pytest.mark.usefixtures("setup_context")
 class TestUserInstallTest:
 
-    def setup_method(self, method):
-        self.old_file = easy_install_pkg.__file__
-        easy_install_pkg.__file__ = site.USER_SITE
-
-    def teardown_method(self, method):
-        easy_install_pkg.__file__ = self.old_file
-
+    @mock.patch('setuptools.command.easy_install.__file__', None)
     def test_user_install_implied(self):
         easy_install_pkg.__file__ = site.USER_SITE
         site.ENABLE_USER_SITE = True # disabled sometimes
-- 
cgit v1.2.1


From 943d583e1ec0d6e4a8a4f3be4361223c39e937d5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 09:17:00 -0500
Subject: Remove unused import

---
 setuptools/tests/test_develop.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index f18ddd6e..ed1b194a 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -6,7 +6,6 @@ import site
 import sys
 import tempfile
 
-from distutils.errors import DistutilsError
 from setuptools.command.develop import develop
 from setuptools.dist import Distribution
 
-- 
cgit v1.2.1


From b14ed9cb87ba7f9aff5baecceae9ca54351a6b4e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 09:37:45 -0500
Subject: Convert remaining tests in test_easy_install to pytest.

---
 setuptools/tests/test_easy_install.py | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index e052ff1e..b3fa9cff 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -4,7 +4,6 @@ import sys
 import os
 import shutil
 import tempfile
-import unittest
 import site
 import contextlib
 import textwrap
@@ -67,7 +66,7 @@ SETUP_PY = DALS("""
     setup(name='foo')
     """)
 
-class TestEasyInstallTest(unittest.TestCase):
+class TestEasyInstallTest:
 
     def test_install_site_py(self):
         dist = Distribution()
@@ -77,7 +76,7 @@ class TestEasyInstallTest(unittest.TestCase):
         try:
             cmd.install_site_py()
             sitepy = os.path.join(cmd.install_dir, 'site.py')
-            self.assertTrue(os.path.exists(sitepy))
+            assert os.path.exists(sitepy)
         finally:
             shutil.rmtree(cmd.install_dir)
 
@@ -87,7 +86,7 @@ class TestEasyInstallTest(unittest.TestCase):
         args = next(get_script_args(dist))
         name, script = itertools.islice(args, 2)
 
-        self.assertEqual(script, WANTED)
+        assert script == WANTED
 
     def test_no_find_links(self):
         # new option '--no-find-links', that blocks find-links added at
@@ -100,7 +99,7 @@ class TestEasyInstallTest(unittest.TestCase):
         cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
         cmd.args = ['ok']
         cmd.ensure_finalized()
-        self.assertEqual(cmd.package_index.scanned_urls, {})
+        assert cmd.package_index.scanned_urls == {}
 
         # let's try without it (default behavior)
         cmd = easy_install(dist)
@@ -110,27 +109,27 @@ class TestEasyInstallTest(unittest.TestCase):
         cmd.args = ['ok']
         cmd.ensure_finalized()
         keys = sorted(cmd.package_index.scanned_urls.keys())
-        self.assertEqual(keys, ['link1', 'link2'])
+        assert keys == ['link1', 'link2']
 
 
-class TestPTHFileWriter(unittest.TestCase):
+class TestPTHFileWriter:
     def test_add_from_cwd_site_sets_dirty(self):
         '''a pth file manager should set dirty
         if a distribution is in site but also the cwd
         '''
         pth = PthDistributions('does-not_exist', [os.getcwd()])
-        self.assertTrue(not pth.dirty)
+        assert not pth.dirty
         pth.add(PRDistribution(os.getcwd()))
-        self.assertTrue(pth.dirty)
+        assert pth.dirty
 
     def test_add_from_site_is_ignored(self):
         location = '/test/location/does-not-have-to-exist'
         # PthDistributions expects all locations to be normalized
         location = pkg_resources.normalize_path(location)
         pth = PthDistributions('does-not_exist', [location, ])
-        self.assertTrue(not pth.dirty)
+        assert not pth.dirty
         pth.add(PRDistribution(location))
-        self.assertTrue(not pth.dirty)
+        assert not pth.dirty
 
 
 @pytest.yield_fixture
@@ -276,7 +275,7 @@ class TestDistutilsPackage:
         run_setup('setup.py', ['bdist_egg'])
 
 
-class TestSetupRequires(unittest.TestCase):
+class TestSetupRequires:
 
     def test_setup_requires_honors_fetch_params(self):
         """
@@ -312,8 +311,8 @@ class TestSetupRequires(unittest.TestCase):
                                 easy_install_pkg.main(ei_params)
         # there should have been two or three requests to the server
         #  (three happens on Python 3.3a)
-        self.assertTrue(2 <= len(p_index.requests) <= 3)
-        self.assertEqual(p_index.requests[0].path, '/does-not-exist/')
+        assert 2 <= len(p_index.requests) <= 3
+        assert p_index.requests[0].path == '/does-not-exist/'
 
     @staticmethod
     @contextlib.contextmanager
@@ -363,8 +362,8 @@ class TestSetupRequires(unittest.TestCase):
                             'caused a VersionConflict')
 
                 lines = stdout.readlines()
-                self.assertTrue(len(lines) > 0)
-                self.assertTrue(lines[-1].strip(), 'test_pkg')
+                assert len(lines) > 0
+                assert lines[-1].strip(), 'test_pkg'
         finally:
             pkg_resources.__setstate__(pr_state)
 
-- 
cgit v1.2.1


From bbb68a8b848f9dbd4d44419fdae93b5e057763e5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 09:49:58 -0500
Subject: Rewrite test using pytest.

---
 setuptools/tests/fixtures.py      |  7 +++++++
 setuptools/tests/test_egg_info.py | 39 +++++++++++++--------------------------
 2 files changed, 20 insertions(+), 26 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index 225c2ea3..0b1eaf5f 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -3,6 +3,7 @@ import pytest
 
 from . import contexts
 
+
 @pytest.yield_fixture
 def user_override():
     """
@@ -15,3 +16,9 @@ def user_override():
                 with mock.patch('site.USER_SITE', user_site):
                     with contexts.save_user_site_setting():
                         yield
+
+
+@pytest.yield_fixture
+def tmpdir_cwd(tmpdir):
+    with tmpdir.as_cwd() as orig:
+        yield orig
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 6b4d917f..d8c3252e 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -2,22 +2,11 @@ import os
 import tempfile
 import shutil
 import stat
-import unittest
 
 from . import environment
 
 
-class TestEggInfo(unittest.TestCase):
-
-    def setUp(self):
-        self.test_dir = tempfile.mkdtemp()
-
-        self.old_cwd = os.getcwd()
-        os.chdir(self.test_dir)
-
-    def tearDown(self):
-        os.chdir(self.old_cwd)
-        shutil.rmtree(self.test_dir)
+class TestEggInfo:
 
     def _create_project(self):
         with open('setup.py', 'w') as f:
@@ -33,7 +22,7 @@ class TestEggInfo(unittest.TestCase):
             f.write('def run():\n')
             f.write("    print('hello')\n")
 
-    def test_egg_base_installed_egg_info(self):
+    def test_egg_base_installed_egg_info(self, tmpdir_cwd):
         self._create_project()
         temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
         os.chmod(temp_dir, stat.S_IRWXU)
@@ -54,7 +43,7 @@ class TestEggInfo(unittest.TestCase):
                     '--install-lib', paths['lib'],
                     '--install-scripts', paths['scripts'],
                     '--install-data', paths['data']],
-                pypath=os.pathsep.join([paths['lib'], self.old_cwd]),
+                pypath=os.pathsep.join([paths['lib'], str(tmpdir_cwd)]),
                 data_stream=1,
                 env=environ)
             if code:
@@ -63,17 +52,15 @@ class TestEggInfo(unittest.TestCase):
             for dirpath, dirnames, filenames in os.walk(paths['lib']):
                 if os.path.basename(dirpath) == 'EGG-INFO':
                     egg_info = sorted(filenames)
-            self.assertEqual(
-                egg_info,
-                ['PKG-INFO',
-                 'SOURCES.txt',
-                 'dependency_links.txt',
-                 'entry_points.txt',
-                 'not-zip-safe',
-                 'top_level.txt'])
+
+            expected = [
+                'PKG-INFO',
+                'SOURCES.txt',
+                'dependency_links.txt',
+                'entry_points.txt',
+                'not-zip-safe',
+                'top_level.txt',
+            ]
+            assert egg_info == expected
         finally:
             shutil.rmtree(temp_dir)
-
-
-def test_suite():
-    return unittest.defaultTestLoader.loadTestsFromName(__name__)
-- 
cgit v1.2.1


From b21f02bdaeab48de81c90142b5ff80c900739613 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 09:55:33 -0500
Subject: Combine DALS implementations in textwrap module.

---
 setuptools/tests/test_dist_info.py        |  5 +----
 setuptools/tests/test_easy_install.py     | 11 +++--------
 setuptools/tests/test_windows_wrappers.py |  2 ++
 3 files changed, 6 insertions(+), 12 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index eab17335..6d0ab587 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -3,15 +3,12 @@
 import os
 import shutil
 import tempfile
-import textwrap
 
 import pytest
 
 import pkg_resources
+from .textwrap import DALS
 
-def DALS(s):
-    "dedent and left-strip"
-    return textwrap.dedent(s).lstrip()
 
 class TestDistInfo:
 
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index b3fa9cff..30789e83 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -1,12 +1,13 @@
 """Easy install Tests
 """
+from __future__ import absolute_import
+
 import sys
 import os
 import shutil
 import tempfile
 import site
 import contextlib
-import textwrap
 import tarfile
 import logging
 import itertools
@@ -29,13 +30,7 @@ import pkg_resources
 
 from .py26compat import tarfile_open
 from . import contexts
-
-
-def DALS(input):
-    """
-    Dedent and left-strip
-    """
-    return textwrap.dedent(input).lstrip()
+from .textwrap import DALS
 
 
 class FakeDist(object):
diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index b6c1e573..5b14d07b 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -12,6 +12,8 @@ the script they are to wrap and with the same name as the script they
 are to wrap.
 """
 
+from __future__ import absolute_import
+
 import sys
 import textwrap
 import subprocess
-- 
cgit v1.2.1


From e814d51b89cdfb3cd5ec567726c5756f6872041e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 09:59:44 -0500
Subject: Replace cluttered script generation with multiline strings

---
 setuptools/tests/test_egg_info.py | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index d8c3252e..6d51955c 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -4,23 +4,31 @@ import shutil
 import stat
 
 from . import environment
+from .textwrap import DALS
 
 
 class TestEggInfo:
 
+    setup_script = DALS("""
+        from setuptools import setup
+
+        setup(
+            name='foo',
+            py_modules=['hello'],
+            entry_points={'console_scripts': ['hi = hello.run']},
+            zip_safe=False,
+        )
+        """)
+
     def _create_project(self):
         with open('setup.py', 'w') as f:
-            f.write('from setuptools import setup\n')
-            f.write('\n')
-            f.write('setup(\n')
-            f.write("    name='foo',\n")
-            f.write("    py_modules=['hello'],\n")
-            f.write("    entry_points={'console_scripts': ['hi = hello.run']},\n")
-            f.write('    zip_safe=False,\n')
-            f.write('    )\n')
+            f.write(self.setup_script)
+
         with open('hello.py', 'w') as f:
-            f.write('def run():\n')
-            f.write("    print('hello')\n")
+            f.write(DALS("""
+                def run():
+                    print('hello')
+                """))
 
     def test_egg_base_installed_egg_info(self, tmpdir_cwd):
         self._create_project()
-- 
cgit v1.2.1


From 66ed0829c7d9e59592d0d977ac7f51e772b666f8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:03:30 -0500
Subject: Use contexts for tempdir generation

---
 setuptools/tests/contexts.py      |  4 ++--
 setuptools/tests/test_egg_info.py | 10 +++-------
 2 files changed, 5 insertions(+), 9 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py
index 1620bdb3..10691606 100644
--- a/setuptools/tests/contexts.py
+++ b/setuptools/tests/contexts.py
@@ -9,8 +9,8 @@ from ..compat import StringIO
 
 
 @contextlib.contextmanager
-def tempdir(cd=lambda dir:None):
-    temp_dir = tempfile.mkdtemp()
+def tempdir(cd=lambda dir:None, **kwargs):
+    temp_dir = tempfile.mkdtemp(**kwargs)
     orig_dir = os.getcwd()
     try:
         cd(temp_dir)
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 6d51955c..6d7ba345 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,10 +1,9 @@
 import os
-import tempfile
-import shutil
 import stat
 
 from . import environment
 from .textwrap import DALS
+from . import contexts
 
 
 class TestEggInfo:
@@ -32,9 +31,8 @@ class TestEggInfo:
 
     def test_egg_base_installed_egg_info(self, tmpdir_cwd):
         self._create_project()
-        temp_dir = tempfile.mkdtemp(prefix='setuptools-test.')
-        os.chmod(temp_dir, stat.S_IRWXU)
-        try:
+        with contexts.tempdir(prefix='setuptools-test.') as temp_dir:
+            os.chmod(temp_dir, stat.S_IRWXU)
             paths = {}
             for dirname in ['home', 'lib', 'scripts', 'data', 'egg-base']:
                 paths[dirname] = os.path.join(temp_dir, dirname)
@@ -70,5 +68,3 @@ class TestEggInfo:
                 'top_level.txt',
             ]
             assert egg_info == expected
-        finally:
-            shutil.rmtree(temp_dir)
-- 
cgit v1.2.1


From a0bfbbff64b076dab3d4c07b488043a42932bd3e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:07:53 -0500
Subject: Rewrite paths construction as generator expression.

---
 setuptools/tests/test_egg_info.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 6d7ba345..a92779d5 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -33,10 +33,12 @@ class TestEggInfo:
         self._create_project()
         with contexts.tempdir(prefix='setuptools-test.') as temp_dir:
             os.chmod(temp_dir, stat.S_IRWXU)
-            paths = {}
-            for dirname in ['home', 'lib', 'scripts', 'data', 'egg-base']:
-                paths[dirname] = os.path.join(temp_dir, dirname)
-                os.mkdir(paths[dirname])
+            subs = 'home', 'lib', 'scripts', 'data', 'egg-base'
+            paths = dict(
+                (dirname, os.path.join(temp_dir, dirname))
+                for dirname in subs
+            )
+            list(map(os.mkdir, paths.values()))
             config = os.path.join(paths['home'], '.pydistutils.cfg')
             with open(config, 'w') as f:
                 f.write('[egg_info]\n')
-- 
cgit v1.2.1


From 0dc996c482a8ec3e248b57ed731ec24286e408e1 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:08:56 -0500
Subject: Rewrite config generation

---
 setuptools/tests/test_egg_info.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index a92779d5..4a161c8b 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -41,8 +41,11 @@ class TestEggInfo:
             list(map(os.mkdir, paths.values()))
             config = os.path.join(paths['home'], '.pydistutils.cfg')
             with open(config, 'w') as f:
-                f.write('[egg_info]\n')
-                f.write('egg-base = %s\n' % paths['egg-base'])
+                f.write(DALS("""
+                    [egg_info]
+                    egg-base = %(egg-base)s
+                    """ % paths
+                ))
             environ = os.environ.copy()
             environ['HOME'] = paths['home']
             code, data = environment.run_setup_py(
-- 
cgit v1.2.1


From 73124a8934cf152a0f853809bc78e5dd42d8b9c2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:09:38 -0500
Subject: Rewrite command construction for clarity.

---
 setuptools/tests/test_egg_info.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 4a161c8b..f20877a5 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -48,12 +48,15 @@ class TestEggInfo:
                 ))
             environ = os.environ.copy()
             environ['HOME'] = paths['home']
+            cmd = [
+                'install',
+                '--home', paths['home'],
+                '--install-lib', paths['lib'],
+                '--install-scripts', paths['scripts'],
+                '--install-data', paths['data'],
+            ]
             code, data = environment.run_setup_py(
-                cmd=[
-                    'install', '--home', paths['home'],
-                    '--install-lib', paths['lib'],
-                    '--install-scripts', paths['scripts'],
-                    '--install-data', paths['data']],
+                cmd=cmd,
                 pypath=os.pathsep.join([paths['lib'], str(tmpdir_cwd)]),
                 data_stream=1,
                 env=environ)
-- 
cgit v1.2.1


From d7aa4bbad9497e548fd0c7b4f935fe1eb94ba613 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:09:53 -0500
Subject: Use trailing comma for consistency.

---
 setuptools/tests/test_egg_info.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index f20877a5..efc66c93 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -59,7 +59,8 @@ class TestEggInfo:
                 cmd=cmd,
                 pypath=os.pathsep.join([paths['lib'], str(tmpdir_cwd)]),
                 data_stream=1,
-                env=environ)
+                env=environ,
+            )
             if code:
                 raise AssertionError(data)
             egg_info = None
-- 
cgit v1.2.1


From 0822c8ff070891e63471e63b67ea97ff9803c0f5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:15:02 -0500
Subject: Extract method for _find_egg_info_files.

---
 setuptools/tests/test_egg_info.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index efc66c93..450c898e 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -63,10 +63,8 @@ class TestEggInfo:
             )
             if code:
                 raise AssertionError(data)
-            egg_info = None
-            for dirpath, dirnames, filenames in os.walk(paths['lib']):
-                if os.path.basename(dirpath) == 'EGG-INFO':
-                    egg_info = sorted(filenames)
+
+            actual = self._find_egg_info_files(paths['lib'])
 
             expected = [
                 'PKG-INFO',
@@ -76,4 +74,14 @@ class TestEggInfo:
                 'not-zip-safe',
                 'top_level.txt',
             ]
-            assert egg_info == expected
+            assert sorted(actual) == expected
+
+    def _find_egg_info_files(self, root):
+        results = (
+            filenames
+            for dirpath, dirnames, filenames in os.walk(root)
+            if os.path.basename(dirpath) == 'EGG-INFO'
+        )
+        # expect exactly one result
+        result, = results
+        return result
-- 
cgit v1.2.1


From deef22ce4589e31cc23c4e4d570ee6fab75bd06c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:16:54 -0500
Subject: Use update to set the home environment variable.

---
 setuptools/tests/test_egg_info.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 450c898e..77d2eee7 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -46,8 +46,9 @@ class TestEggInfo:
                     egg-base = %(egg-base)s
                     """ % paths
                 ))
-            environ = os.environ.copy()
-            environ['HOME'] = paths['home']
+            environ = os.environ.copy().update(
+                HOME=paths['home'],
+            )
             cmd = [
                 'install',
                 '--home', paths['home'],
-- 
cgit v1.2.1


From 08bac0ab2f411b7d50d04d8df66d24d24de6644b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:25:29 -0500
Subject: Extract fixture for the environment.

---
 setuptools/tests/test_egg_info.py | 84 ++++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 37 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 77d2eee7..a1caf9fd 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -1,6 +1,8 @@
 import os
 import stat
 
+import pytest
+
 from . import environment
 from .textwrap import DALS
 from . import contexts
@@ -29,53 +31,61 @@ class TestEggInfo:
                     print('hello')
                 """))
 
-    def test_egg_base_installed_egg_info(self, tmpdir_cwd):
-        self._create_project()
-        with contexts.tempdir(prefix='setuptools-test.') as temp_dir:
-            os.chmod(temp_dir, stat.S_IRWXU)
+    @pytest.yield_fixture
+    def env(self):
+        class Environment(str): pass
+
+        with contexts.tempdir(prefix='setuptools-test.') as env_dir:
+            env = Environment(env_dir)
+            os.chmod(env_dir, stat.S_IRWXU)
             subs = 'home', 'lib', 'scripts', 'data', 'egg-base'
-            paths = dict(
-                (dirname, os.path.join(temp_dir, dirname))
+            env.paths = dict(
+                (dirname, os.path.join(env_dir, dirname))
                 for dirname in subs
             )
-            list(map(os.mkdir, paths.values()))
-            config = os.path.join(paths['home'], '.pydistutils.cfg')
+            list(map(os.mkdir, env.paths.values()))
+            config = os.path.join(env.paths['home'], '.pydistutils.cfg')
             with open(config, 'w') as f:
                 f.write(DALS("""
                     [egg_info]
                     egg-base = %(egg-base)s
-                    """ % paths
+                    """ % env.paths
                 ))
-            environ = os.environ.copy().update(
-                HOME=paths['home'],
-            )
-            cmd = [
-                'install',
-                '--home', paths['home'],
-                '--install-lib', paths['lib'],
-                '--install-scripts', paths['scripts'],
-                '--install-data', paths['data'],
-            ]
-            code, data = environment.run_setup_py(
-                cmd=cmd,
-                pypath=os.pathsep.join([paths['lib'], str(tmpdir_cwd)]),
-                data_stream=1,
-                env=environ,
-            )
-            if code:
-                raise AssertionError(data)
+            yield env
+
+    def test_egg_base_installed_egg_info(self, tmpdir_cwd, env):
+        self._create_project()
+
+        environ = os.environ.copy().update(
+            HOME=env.paths['home'],
+        )
+        cmd = [
+            'install',
+            '--home', env.paths['home'],
+            '--install-lib', env.paths['lib'],
+            '--install-scripts', env.paths['scripts'],
+            '--install-data', env.paths['data'],
+        ]
+        code, data = environment.run_setup_py(
+            cmd=cmd,
+            pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
+            data_stream=1,
+            env=environ,
+        )
+        if code:
+            raise AssertionError(data)
 
-            actual = self._find_egg_info_files(paths['lib'])
+        actual = self._find_egg_info_files(env.paths['lib'])
 
-            expected = [
-                'PKG-INFO',
-                'SOURCES.txt',
-                'dependency_links.txt',
-                'entry_points.txt',
-                'not-zip-safe',
-                'top_level.txt',
-            ]
-            assert sorted(actual) == expected
+        expected = [
+            'PKG-INFO',
+            'SOURCES.txt',
+            'dependency_links.txt',
+            'entry_points.txt',
+            'not-zip-safe',
+            'top_level.txt',
+        ]
+        assert sorted(actual) == expected
 
     def _find_egg_info_files(self, root):
         results = (
-- 
cgit v1.2.1


From 8fdf776320fa82dfe4b5dc86f8986f6e22fa6ac2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:33:13 -0500
Subject: Update test_find_packages to use pytest

---
 setuptools/tests/test_find_packages.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py
index 50513a69..06a7c02e 100644
--- a/setuptools/tests/test_find_packages.py
+++ b/setuptools/tests/test_find_packages.py
@@ -3,7 +3,6 @@ import os
 import sys
 import shutil
 import tempfile
-import unittest
 import platform
 
 import pytest
@@ -34,13 +33,13 @@ def has_symlink():
     )
     return can_symlink() and not bad_symlink
 
-class TestFindPackages(unittest.TestCase):
+class TestFindPackages:
 
-    def setUp(self):
+    def setup_method(self, method):
         self.dist_dir = tempfile.mkdtemp()
         self._make_pkg_structure()
 
-    def tearDown(self):
+    def teardown_method(self, method):
         shutil.rmtree(self.dist_dir)
 
     def _make_pkg_structure(self):
@@ -88,7 +87,7 @@ class TestFindPackages(unittest.TestCase):
     def test_regular_package(self):
         self._touch('__init__.py', self.pkg_dir)
         packages = find_packages(self.dist_dir)
-        self.assertEqual(packages, ['pkg', 'pkg.subpkg'])
+        assert packages == ['pkg', 'pkg.subpkg']
 
     def test_exclude(self):
         self._touch('__init__.py', self.pkg_dir)
@@ -103,7 +102,7 @@ class TestFindPackages(unittest.TestCase):
         alt_dir = self._mkdir('other_pkg', self.dist_dir)
         self._touch('__init__.py', alt_dir)
         packages = find_packages(self.dist_dir, include=['other_pkg'])
-        self.assertEqual(packages, ['other_pkg'])
+        assert packages == ['other_pkg']
 
     def test_dir_with_dot_is_skipped(self):
         shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets'))
@@ -111,7 +110,7 @@ class TestFindPackages(unittest.TestCase):
         self._touch('__init__.py', data_dir)
         self._touch('file.dat', data_dir)
         packages = find_packages(self.dist_dir)
-        self.assertTrue('pkg.some.data' not in packages)
+        assert 'pkg.some.data' not in packages
 
     def test_dir_with_packages_in_subdir_is_excluded(self):
         """
@@ -122,7 +121,7 @@ class TestFindPackages(unittest.TestCase):
         build_pkg_dir = self._mkdir('pkg', build_dir)
         self._touch('__init__.py', build_pkg_dir)
         packages = find_packages(self.dist_dir)
-        self.assertTrue('build.pkg' not in packages)
+        assert 'build.pkg' not in packages
 
     @pytest.mark.skipif(not has_symlink(), reason='Symlink support required')
     def test_symlinked_packages_are_included(self):
@@ -137,10 +136,10 @@ class TestFindPackages(unittest.TestCase):
         os.symlink('pkg', linked_pkg)
         assert os.path.isdir(linked_pkg)
         packages = find_packages(self.dist_dir)
-        self.assertTrue('lpkg' in packages)
+        assert 'lpkg' in packages
 
     def _assert_packages(self, actual, expected):
-        self.assertEqual(set(actual), set(expected))
+        assert set(actual) == set(expected)
 
     def test_pep420_ns_package(self):
         packages = find_420_packages(
-- 
cgit v1.2.1


From 9534a401d57558cf469263beb0a35895dc81d043 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:41:10 -0500
Subject: Resave with excess whitespace removed

---
 setuptools/tests/test_integration.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py
index 8d6c1e55..411203ff 100644
--- a/setuptools/tests/test_integration.py
+++ b/setuptools/tests/test_integration.py
@@ -27,7 +27,7 @@ def install_context(request, tmpdir, monkeypatch):
     def fin():
         # undo the monkeypatch, particularly needed under
         # windows because of kept handle on cwd
-        monkeypatch.undo() 
+        monkeypatch.undo()
         new_cwd.remove()
         user_base.remove()
         user_site.remove()
-- 
cgit v1.2.1


From cf66bbce25e2631bc36d6edfd609705a53b6ef61 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:41:41 -0500
Subject: Add omitted module.

---
 setuptools/tests/textwrap.py | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 setuptools/tests/textwrap.py

(limited to 'setuptools')

diff --git a/setuptools/tests/textwrap.py b/setuptools/tests/textwrap.py
new file mode 100644
index 00000000..5cd9e5bc
--- /dev/null
+++ b/setuptools/tests/textwrap.py
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+import textwrap
+
+
+def DALS(s):
+    "dedent and left-strip"
+    return textwrap.dedent(s).lstrip()
-- 
cgit v1.2.1


From 30f3068b7429f401bcbf1955de8fa370f3f8c8b0 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:42:49 -0500
Subject: Remove expected failure from pbr package as it appears to be working
 now.

---
 setuptools/tests/test_integration.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py
index 411203ff..3a6abeaa 100644
--- a/setuptools/tests/test_integration.py
+++ b/setuptools/tests/test_integration.py
@@ -71,7 +71,6 @@ def test_virtualenvwrapper(install_context):
                  'virtualenvwrapper', 'hook_loader.py')
 
 
-@pytest.mark.xfail
 def test_pbr(install_context):
     _install_one('pbr', install_context,
                  'pbr', 'core.py')
-- 
cgit v1.2.1


From 6fbf8f8eb100b60155ace52aaad3eee076e690f0 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:50:17 -0500
Subject: Use simple assertions and pytest runner for test_markerlib.

---
 setuptools/tests/test_markerlib.py | 51 +++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 26 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_markerlib.py b/setuptools/tests/test_markerlib.py
index 0cb9e70a..8197b49d 100644
--- a/setuptools/tests/test_markerlib.py
+++ b/setuptools/tests/test_markerlib.py
@@ -1,10 +1,9 @@
 import os
-import unittest
 
 import pytest
 
 
-class TestMarkerlib(unittest.TestCase):
+class TestMarkerlib:
 
     @pytest.mark.importorskip('ast')
     def test_markers(self):
@@ -12,32 +11,32 @@ class TestMarkerlib(unittest.TestCase):
 
         os_name = os.name
 
-        self.assertTrue(interpret(""))
-
-        self.assertTrue(interpret("os.name != 'buuuu'"))
-        self.assertTrue(interpret("os_name != 'buuuu'"))
-        self.assertTrue(interpret("python_version > '1.0'"))
-        self.assertTrue(interpret("python_version < '5.0'"))
-        self.assertTrue(interpret("python_version <= '5.0'"))
-        self.assertTrue(interpret("python_version >= '1.0'"))
-        self.assertTrue(interpret("'%s' in os.name" % os_name))
-        self.assertTrue(interpret("'%s' in os_name" % os_name))
-        self.assertTrue(interpret("'buuuu' not in os.name"))
-
-        self.assertFalse(interpret("os.name == 'buuuu'"))
-        self.assertFalse(interpret("os_name == 'buuuu'"))
-        self.assertFalse(interpret("python_version < '1.0'"))
-        self.assertFalse(interpret("python_version > '5.0'"))
-        self.assertFalse(interpret("python_version >= '5.0'"))
-        self.assertFalse(interpret("python_version <= '1.0'"))
-        self.assertFalse(interpret("'%s' not in os.name" % os_name))
-        self.assertFalse(interpret("'buuuu' in os.name and python_version >= '5.0'"))
-        self.assertFalse(interpret("'buuuu' in os_name and python_version >= '5.0'"))
+        assert interpret("")
+
+        assert interpret("os.name != 'buuuu'")
+        assert interpret("os_name != 'buuuu'")
+        assert interpret("python_version > '1.0'")
+        assert interpret("python_version < '5.0'")
+        assert interpret("python_version <= '5.0'")
+        assert interpret("python_version >= '1.0'")
+        assert interpret("'%s' in os.name" % os_name)
+        assert interpret("'%s' in os_name" % os_name)
+        assert interpret("'buuuu' not in os.name")
+
+        assert not interpret("os.name == 'buuuu'")
+        assert not interpret("os_name == 'buuuu'")
+        assert not interpret("python_version < '1.0'")
+        assert not interpret("python_version > '5.0'")
+        assert not interpret("python_version >= '5.0'")
+        assert not interpret("python_version <= '1.0'")
+        assert not interpret("'%s' not in os.name" % os_name)
+        assert not interpret("'buuuu' in os.name and python_version >= '5.0'")
+        assert not interpret("'buuuu' in os_name and python_version >= '5.0'")
 
         environment = default_environment()
         environment['extra'] = 'test'
-        self.assertTrue(interpret("extra == 'test'", environment))
-        self.assertFalse(interpret("extra == 'doc'", environment))
+        assert interpret("extra == 'test'", environment)
+        assert not interpret("extra == 'doc'", environment)
 
         def raises_nameError():
             try:
@@ -60,5 +59,5 @@ class TestMarkerlib(unittest.TestCase):
         raises_syntaxError()
 
         statement = "python_version == '5'"
-        self.assertEqual(compile(statement).__doc__, statement)
+        assert compile(statement).__doc__ == statement
 
-- 
cgit v1.2.1


From 7c075fcc356078930535230fbc975b76db9d68cc Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:55:40 -0500
Subject: Extend contexts environment patching logic based on context manager
 in test_msvc9compiler and use it.

---
 setuptools/tests/contexts.py           | 30 +++++++++++++++++++++++-------
 setuptools/tests/test_msvc9compiler.py | 31 +++----------------------------
 2 files changed, 26 insertions(+), 35 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py
index 10691606..a604cd41 100644
--- a/setuptools/tests/contexts.py
+++ b/setuptools/tests/contexts.py
@@ -21,15 +21,31 @@ def tempdir(cd=lambda dir:None, **kwargs):
 
 
 @contextlib.contextmanager
-def environment(**updates):
-    old_env = os.environ.copy()
-    os.environ.update(updates)
+def environment(**replacements):
+    """
+    In a context, patch the environment with replacements. Pass None values
+    to clear the values.
+    """
+    saved = dict(
+        (key, os.environ['key'])
+        for key in replacements
+        if key in os.environ
+    )
+
+    # remove values that are null
+    remove = (key for (key, value) in replacements.items() if value is None)
+    for key in list(remove):
+        os.environ.pop(key, None)
+        replacements.pop(key)
+
+    os.environ.update(replacements)
+
     try:
-        yield
+        yield saved
     finally:
-        for key in updates:
-            del os.environ[key]
-        os.environ.update(old_env)
+        for key in replacements:
+            os.environ.pop(key, None)
+        os.environ.update(saved)
 
 
 @contextlib.contextmanager
diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py
index 27747512..2a117dc9 100644
--- a/setuptools/tests/test_msvc9compiler.py
+++ b/setuptools/tests/test_msvc9compiler.py
@@ -10,10 +10,11 @@ import shutil
 import tempfile
 import unittest
 import distutils.errors
-import contextlib
 
 import pytest
 
+from . import contexts
+
 # importing only setuptools should apply the patch
 __import__('setuptools')
 
@@ -62,32 +63,6 @@ class MockReg:
         distutils.msvc9compiler.Reg.read_keys = self.original_read_keys
         distutils.msvc9compiler.Reg.read_values = self.original_read_values
 
-@contextlib.contextmanager
-def patch_env(**replacements):
-    """
-    In a context, patch the environment with replacements. Pass None values
-    to clear the values.
-    """
-    saved = dict(
-        (key, os.environ['key'])
-        for key in replacements
-        if key in os.environ
-    )
-
-    # remove values that are null
-    remove = (key for (key, value) in replacements.items() if value is None)
-    for key in list(remove):
-        os.environ.pop(key, None)
-        replacements.pop(key)
-
-    os.environ.update(replacements)
-
-    try:
-        yield saved
-    finally:
-        for key in replacements:
-            os.environ.pop(key, None)
-        os.environ.update(saved)
 
 class TestMSVC9Compiler(unittest.TestCase):
 
@@ -100,7 +75,7 @@ class TestMSVC9Compiler(unittest.TestCase):
 
         # No registry entries or environment variable means we should
         # not find anything
-        with patch_env(VS90COMNTOOLS=None):
+        with contexts.environment(VS90COMNTOOLS=None):
             with MockReg():
                 self.assertIsNone(find_vcvarsall(9.0))
 
-- 
cgit v1.2.1


From 23d9089cb0e74b75ead48991509f9dff3fa5eff2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 10:58:16 -0500
Subject: Reorganize imports

---
 setuptools/tests/test_packageindex.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index d1d6ca8d..6aec44f9 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -1,11 +1,11 @@
-"""Package Index Tests
-"""
 import sys
 import os
 import unittest
-import pkg_resources
-from setuptools.compat import httplib, HTTPError, unicode, pathname2url
 import distutils.errors
+
+from setuptools.compat import httplib, HTTPError, unicode, pathname2url
+
+import pkg_resources
 import setuptools.package_index
 from setuptools.tests.server import IndexServer
 
-- 
cgit v1.2.1


From 58c0f87887ee451424da702bfd70c0332e28ac5c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 11:05:52 -0500
Subject: Remove dependence on unittest in favor of pytest for test_packgeindex

---
 setuptools/tests/test_packageindex.py | 63 ++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 27 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 6aec44f9..5a46f613 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -9,7 +9,8 @@ import pkg_resources
 import setuptools.package_index
 from setuptools.tests.server import IndexServer
 
-class TestPackageIndex(unittest.TestCase):
+
+class TestPackageIndex:
 
     def test_bad_url_bad_port(self):
         index = setuptools.package_index.PackageIndex()
@@ -18,9 +19,9 @@ class TestPackageIndex(unittest.TestCase):
             v = index.open_url(url)
         except Exception:
             v = sys.exc_info()[1]
-            self.assertTrue(url in str(v))
+            assert url in str(v)
         else:
-            self.assertTrue(isinstance(v, HTTPError))
+            assert isinstance(v, HTTPError)
 
     def test_bad_url_typo(self):
         # issue 16
@@ -35,9 +36,9 @@ class TestPackageIndex(unittest.TestCase):
             v = index.open_url(url)
         except Exception:
             v = sys.exc_info()[1]
-            self.assertTrue(url in str(v))
+            assert url in str(v)
         else:
-            self.assertTrue(isinstance(v, HTTPError))
+            assert isinstance(v, HTTPError)
 
     def test_bad_url_bad_status_line(self):
         index = setuptools.package_index.PackageIndex(
@@ -53,7 +54,7 @@ class TestPackageIndex(unittest.TestCase):
             v = index.open_url(url)
         except Exception:
             v = sys.exc_info()[1]
-            self.assertTrue('line' in str(v))
+            assert 'line' in str(v)
         else:
             raise AssertionError('Should have raise here!')
 
@@ -94,7 +95,7 @@ class TestPackageIndex(unittest.TestCase):
             hosts=('www.example.com',)
         )
         url = 'file:///tmp/test_package_index'
-        self.assertTrue(index.url_ok(url, True))
+        assert index.url_ok(url, True)
 
     def test_links_priority(self):
         """
@@ -127,21 +128,30 @@ class TestPackageIndex(unittest.TestCase):
         server.stop()
 
         # the distribution has been found
-        self.assertTrue('foobar' in pi)
+        assert 'foobar' in pi
         # we have only one link, because links are compared without md5
-        self.assertTrue(len(pi['foobar'])==1)
+        assert len(pi['foobar'])==1
         # the link should be from the index
-        self.assertTrue('correct_md5' in pi['foobar'][0].location)
+        assert 'correct_md5' in pi['foobar'][0].location
 
     def test_parse_bdist_wininst(self):
-        self.assertEqual(setuptools.package_index.parse_bdist_wininst(
-            'reportlab-2.5.win32-py2.4.exe'), ('reportlab-2.5', '2.4', 'win32'))
-        self.assertEqual(setuptools.package_index.parse_bdist_wininst(
-            'reportlab-2.5.win32.exe'), ('reportlab-2.5', None, 'win32'))
-        self.assertEqual(setuptools.package_index.parse_bdist_wininst(
-            'reportlab-2.5.win-amd64-py2.7.exe'), ('reportlab-2.5', '2.7', 'win-amd64'))
-        self.assertEqual(setuptools.package_index.parse_bdist_wininst(
-            'reportlab-2.5.win-amd64.exe'), ('reportlab-2.5', None, 'win-amd64'))
+        parse = setuptools.package_index.parse_bdist_wininst
+
+        actual = parse('reportlab-2.5.win32-py2.4.exe')
+        expected = 'reportlab-2.5', '2.4', 'win32'
+        assert actual == expected
+
+        actual = parse('reportlab-2.5.win32.exe')
+        expected = 'reportlab-2.5', None, 'win32'
+        assert actual == expected
+
+        actual = parse('reportlab-2.5.win-amd64-py2.7.exe')
+        expected = 'reportlab-2.5', '2.7', 'win-amd64'
+        assert actual == expected
+
+        actual = parse('reportlab-2.5.win-amd64.exe')
+        expected = 'reportlab-2.5', None, 'win-amd64'
+        assert actual == expected
 
     def test__vcs_split_rev_from_url(self):
         """
@@ -149,8 +159,8 @@ class TestPackageIndex(unittest.TestCase):
         """
         vsrfu = setuptools.package_index.PackageIndex._vcs_split_rev_from_url
         url, rev = vsrfu('https://example.com/bar@2995')
-        self.assertEqual(url, 'https://example.com/bar')
-        self.assertEqual(rev, '2995')
+        assert url == 'https://example.com/bar'
+        assert rev == '2995'
 
     def test_local_index(self):
         """
@@ -173,31 +183,30 @@ class TestContentCheckers(unittest.TestCase):
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
         checker.feed('You should probably not be using MD5'.encode('ascii'))
-        self.assertEqual(checker.hash.hexdigest(),
-            'f12895fdffbd45007040d2e44df98478')
-        self.assertTrue(checker.is_valid())
+        assert checker.hash.hexdigest() == 'f12895fdffbd45007040d2e44df98478'
+        assert checker.is_valid()
 
     def test_other_fragment(self):
         "Content checks should succeed silently if no hash is present"
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#something%20completely%20different')
         checker.feed('anything'.encode('ascii'))
-        self.assertTrue(checker.is_valid())
+        assert checker.is_valid()
 
     def test_blank_md5(self):
         "Content checks should succeed if a hash is empty"
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#md5=')
         checker.feed('anything'.encode('ascii'))
-        self.assertTrue(checker.is_valid())
+        assert checker.is_valid()
 
     def test_get_hash_name_md5(self):
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
-        self.assertEqual(checker.hash_name, 'md5')
+        assert checker.hash_name == 'md5'
 
     def test_report(self):
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478')
         rep = checker.report(lambda x: x, 'My message about %s')
-        self.assertEqual(rep, 'My message about md5')
+        assert rep == 'My message about md5'
-- 
cgit v1.2.1


From 637da2c7c72edcc5582a4892ae7e18d76910fdf5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 2 Jan 2015 11:13:12 -0500
Subject: Use tmpdir in test_local_index for brevity and isolation.

---
 setuptools/tests/test_packageindex.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

(limited to 'setuptools')

diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 5a46f613..098d4e3f 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -162,18 +162,15 @@ class TestPackageIndex:
         assert url == 'https://example.com/bar'
         assert rev == '2995'
 
-    def test_local_index(self):
+    def test_local_index(self, tmpdir):
         """
         local_open should be able to read an index from the file system.
         """
-        f = open('index.html', 'w')
-        f.write('
content
') - f.close() - try: - url = 'file:' + pathname2url(os.getcwd()) + '/' - res = setuptools.package_index.local_open(url) - finally: - os.remove('index.html') + index_file = tmpdir / 'index.html' + with index_file.open('w') as f: + f.write('
content
') + url = 'file:' + pathname2url(str(tmpdir)) + '/' + res = setuptools.package_index.local_open(url) assert 'content' in res.read() -- cgit v1.2.1 From 9ed373760301e531de21009f26700e55177265e1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:14:16 -0500 Subject: Remove additional references to unittest. --- setuptools/tests/test_packageindex.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 098d4e3f..3e9d1d84 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -1,6 +1,4 @@ import sys -import os -import unittest import distutils.errors from setuptools.compat import httplib, HTTPError, unicode, pathname2url @@ -174,7 +172,7 @@ class TestPackageIndex: assert 'content' in res.read() -class TestContentCheckers(unittest.TestCase): +class TestContentCheckers: def test_md5(self): checker = setuptools.package_index.HashChecker.from_url( -- cgit v1.2.1 From 3412dfc4261abb80dbbd4a17ae3b06308a4a0d95 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:41:30 -0500 Subject: Ported test_resources to pytest from unittest. --- setuptools/tests/test_resources.py | 383 +++++++++++++++++++------------------ 1 file changed, 200 insertions(+), 183 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index ba8835a9..ecd45bca 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -1,12 +1,11 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# NOTE: the shebang and encoding lines are for ScriptHeaderTests do not remove +# NOTE: the shebang and encoding lines are for TestScriptHeader do not remove import os import sys import tempfile import shutil -from unittest import TestCase import pytest @@ -48,36 +47,32 @@ class Metadata(pkg_resources.EmptyProvider): dist_from_fn = pkg_resources.Distribution.from_filename -class DistroTests(TestCase): +class TestDistro: def testCollection(self): # empty path should produce no distributions ad = pkg_resources.Environment([], platform=None, python=None) - self.assertEqual(list(ad), []) - self.assertEqual(ad['FooPkg'],[]) + assert list(ad) == [] + assert ad['FooPkg'] == [] ad.add(dist_from_fn("FooPkg-1.3_1.egg")) ad.add(dist_from_fn("FooPkg-1.4-py2.4-win32.egg")) ad.add(dist_from_fn("FooPkg-1.2-py2.4.egg")) # Name is in there now - self.assertTrue(ad['FooPkg']) + assert ad['FooPkg'] # But only 1 package - self.assertEqual(list(ad), ['foopkg']) + assert list(ad) == ['foopkg'] # Distributions sort by version - self.assertEqual( - [dist.version for dist in ad['FooPkg']], ['1.4','1.3-1','1.2'] - ) + assert [dist.version for dist in ad['FooPkg']] == ['1.4','1.3-1','1.2'] + # Removing a distribution leaves sequence alone ad.remove(ad['FooPkg'][1]) - self.assertEqual( - [dist.version for dist in ad['FooPkg']], ['1.4','1.2'] - ) + assert [dist.version for dist in ad['FooPkg']] == ['1.4','1.2'] + # And inserting adds them in order ad.add(dist_from_fn("FooPkg-1.9.egg")) - self.assertEqual( - [dist.version for dist in ad['FooPkg']], ['1.9','1.4','1.2'] - ) + assert [dist.version for dist in ad['FooPkg']] == ['1.9','1.4','1.2'] ws = WorkingSet([]) foo12 = dist_from_fn("FooPkg-1.2-py2.4.egg") @@ -85,31 +80,32 @@ class DistroTests(TestCase): req, = parse_requirements("FooPkg>=1.3") # Nominal case: no distros on path, should yield all applicable - self.assertEqual(ad.best_match(req,ws).version, '1.9') + assert ad.best_match(req, ws).version == '1.9' # If a matching distro is already installed, should return only that ws.add(foo14) - self.assertEqual(ad.best_match(req,ws).version, '1.4') + assert ad.best_match(req, ws).version == '1.4' # If the first matching distro is unsuitable, it's a version conflict ws = WorkingSet([]) ws.add(foo12) ws.add(foo14) - self.assertRaises(VersionConflict, ad.best_match, req, ws) + with pytest.raises(VersionConflict): + ad.best_match(req, ws) # If more than one match on the path, the first one takes precedence ws = WorkingSet([]) ws.add(foo14) ws.add(foo12) ws.add(foo14) - self.assertEqual(ad.best_match(req,ws).version, '1.4') + assert ad.best_match(req, ws).version == '1.4' def checkFooPkg(self,d): - self.assertEqual(d.project_name, "FooPkg") - self.assertEqual(d.key, "foopkg") - self.assertEqual(d.version, "1.3.post1") - self.assertEqual(d.py_version, "2.4") - self.assertEqual(d.platform, "win32") - self.assertEqual(d.parsed_version, parse_version("1.3-1")) + assert d.project_name == "FooPkg" + assert d.key == "foopkg" + assert d.version == "1.3.post1" + assert d.py_version == "2.4" + assert d.platform == "win32" + assert d.parsed_version == parse_version("1.3-1") def testDistroBasics(self): d = Distribution( @@ -119,8 +115,8 @@ class DistroTests(TestCase): self.checkFooPkg(d) d = Distribution("/some/path") - self.assertEqual(d.py_version, sys.version[:3]) - self.assertEqual(d.platform, None) + assert d.py_version == sys.version[:3] + assert d.platform == None def testDistroParse(self): d = dist_from_fn("FooPkg-1.3.post1-py2.4-win32.egg") @@ -141,10 +137,7 @@ class DistroTests(TestCase): return Distribution("/foo", metadata=Metadata(('depends.txt', txt))) def checkRequires(self, dist, txt, extras=()): - self.assertEqual( - list(dist.requires(extras)), - list(parse_requirements(txt)) - ) + assert list(dist.requires(extras)) == list(parse_requirements(txt)) def testDistroDependsSimple(self): for v in "Twisted>=1.5", "Twisted>=1.5\nZConfig>=2.0": @@ -154,11 +147,11 @@ class DistroTests(TestCase): ad = pkg_resources.Environment([]) ws = WorkingSet([]) # Resolving no requirements -> nothing to install - self.assertEqual(list(ws.resolve([],ad)), []) + assert list(ws.resolve([], ad)) == [] # Request something not in the collection -> DistributionNotFound - self.assertRaises( - pkg_resources.DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad - ) + with pytest.raises(pkg_resources.DistributionNotFound): + ws.resolve(parse_requirements("Foo"), ad) + Foo = Distribution.from_filename( "/foo_dir/Foo-1.2.egg", metadata=Metadata(('depends.txt', "[bar]\nBaz>=2.0")) @@ -169,28 +162,25 @@ class DistroTests(TestCase): # Request thing(s) that are available -> list to activate for i in range(3): targets = list(ws.resolve(parse_requirements("Foo"), ad)) - self.assertEqual(targets, [Foo]) + assert targets == [Foo] list(map(ws.add,targets)) - self.assertRaises(VersionConflict, ws.resolve, - parse_requirements("Foo==0.9"), ad) + with pytest.raises(VersionConflict): + ws.resolve(parse_requirements("Foo==0.9"), ad) ws = WorkingSet([]) # reset # Request an extra that causes an unresolved dependency for "Baz" - self.assertRaises( - pkg_resources.DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad - ) + with pytest.raises(pkg_resources.DistributionNotFound): + ws.resolve(parse_requirements("Foo[bar]"), ad) Baz = Distribution.from_filename( "/foo_dir/Baz-2.1.egg", metadata=Metadata(('depends.txt', "Foo")) ) ad.add(Baz) # Activation list now includes resolved dependency - self.assertEqual( - list(ws.resolve(parse_requirements("Foo[bar]"), ad)), [Foo,Baz] - ) + assert list(ws.resolve(parse_requirements("Foo[bar]"), ad)) ==[Foo,Baz] # Requests for conflicting versions produce VersionConflict - self.assertRaises(VersionConflict, - ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad) + with pytest.raises(VersionConflict): + ws.resolve(parse_requirements("Foo==1.2\nFoo!=1.2"), ad) def testDistroDependsOptions(self): d = self.distRequires(""" @@ -215,49 +205,50 @@ class DistroTests(TestCase): d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(), ["fastcgi", "docgen"] ) - self.assertRaises(pkg_resources.UnknownExtra, d.requires, ["foo"]) + with pytest.raises(pkg_resources.UnknownExtra): + d.requires(["foo"]) -class EntryPointTests(TestCase): +class TestEntryPoints: def assertfields(self, ep): - self.assertEqual(ep.name,"foo") - self.assertEqual(ep.module_name,"setuptools.tests.test_resources") - self.assertEqual(ep.attrs, ("EntryPointTests",)) - self.assertEqual(ep.extras, ("x",)) - self.assertTrue(ep.load() is EntryPointTests) - self.assertEqual( - str(ep), - "foo = setuptools.tests.test_resources:EntryPointTests [x]" + assert ep.name == "foo" + assert ep.module_name == "setuptools.tests.test_resources" + assert ep.attrs == ("TestEntryPoints",) + assert ep.extras == ("x",) + assert ep.load() is TestEntryPoints + assert ( + str(ep) == + "foo = setuptools.tests.test_resources:TestEntryPoints [x]" ) - def setUp(self): + def setup_method(self, method): self.dist = Distribution.from_filename( "FooPkg-1.2-py2.4.egg", metadata=Metadata(('requires.txt','[x]'))) def testBasics(self): ep = EntryPoint( - "foo", "setuptools.tests.test_resources", ["EntryPointTests"], + "foo", "setuptools.tests.test_resources", ["TestEntryPoints"], ["x"], self.dist ) self.assertfields(ep) def testParse(self): - s = "foo = setuptools.tests.test_resources:EntryPointTests [x]" + s = "foo = setuptools.tests.test_resources:TestEntryPoints [x]" ep = EntryPoint.parse(s, self.dist) self.assertfields(ep) ep = EntryPoint.parse("bar baz= spammity[PING]") - self.assertEqual(ep.name,"bar baz") - self.assertEqual(ep.module_name,"spammity") - self.assertEqual(ep.attrs, ()) - self.assertEqual(ep.extras, ("ping",)) + assert ep.name == "bar baz" + assert ep.module_name == "spammity" + assert ep.attrs == () + assert ep.extras == ("ping",) ep = EntryPoint.parse(" fizzly = wocka:foo") - self.assertEqual(ep.name,"fizzly") - self.assertEqual(ep.module_name,"wocka") - self.assertEqual(ep.attrs, ("foo",)) - self.assertEqual(ep.extras, ()) + assert ep.name == "fizzly" + assert ep.module_name == "wocka" + assert ep.attrs == ("foo",) + assert ep.extras == () def testRejects(self): for ep in [ @@ -268,9 +259,9 @@ class EntryPointTests(TestCase): else: raise AssertionError("Should've been bad", ep) def checkSubMap(self, m): - self.assertEqual(len(m), len(self.submap_expect)) + assert len(m) == len(self.submap_expect) for key, ep in iteritems(self.submap_expect): - self.assertEqual(repr(m.get(key)), repr(ep)) + assert repr(m.get(key)) == repr(ep) submap_expect = dict( feature1=EntryPoint('feature1', 'somemodule', ['somefunction']), @@ -286,63 +277,71 @@ class EntryPointTests(TestCase): def testParseList(self): self.checkSubMap(EntryPoint.parse_group("xyz", self.submap_str)) - self.assertRaises(ValueError, EntryPoint.parse_group, "x a", "foo=bar") - self.assertRaises(ValueError, EntryPoint.parse_group, "x", - ["foo=baz", "foo=bar"]) + with pytest.raises(ValueError): + EntryPoint.parse_group("x a", "foo=bar") + with pytest.raises(ValueError): + EntryPoint.parse_group("x", ["foo=baz", "foo=bar"]) def testParseMap(self): m = EntryPoint.parse_map({'xyz':self.submap_str}) self.checkSubMap(m['xyz']) - self.assertEqual(list(m.keys()),['xyz']) + assert list(m.keys()) == ['xyz'] m = EntryPoint.parse_map("[xyz]\n"+self.submap_str) self.checkSubMap(m['xyz']) - self.assertEqual(list(m.keys()),['xyz']) - self.assertRaises(ValueError, EntryPoint.parse_map, ["[xyz]", "[xyz]"]) - self.assertRaises(ValueError, EntryPoint.parse_map, self.submap_str) + assert list(m.keys()) == ['xyz'] + with pytest.raises(ValueError): + EntryPoint.parse_map(["[xyz]", "[xyz]"]) + with pytest.raises(ValueError): + EntryPoint.parse_map(self.submap_str) -class RequirementsTests(TestCase): +class TestRequirements: def testBasics(self): r = Requirement.parse("Twisted>=1.2") - self.assertEqual(str(r),"Twisted>=1.2") - self.assertEqual(repr(r),"Requirement.parse('Twisted>=1.2')") - self.assertEqual(r, Requirement("Twisted", [('>=','1.2')], ())) - self.assertEqual(r, Requirement("twisTed", [('>=','1.2')], ())) - self.assertNotEqual(r, Requirement("Twisted", [('>=','2.0')], ())) - self.assertNotEqual(r, Requirement("Zope", [('>=','1.2')], ())) - self.assertNotEqual(r, Requirement("Zope", [('>=','3.0')], ())) - self.assertNotEqual(r, Requirement.parse("Twisted[extras]>=1.2")) + assert str(r) == "Twisted>=1.2" + assert repr(r) == "Requirement.parse('Twisted>=1.2')" + assert r == Requirement("Twisted", [('>=','1.2')], ()) + assert r == Requirement("twisTed", [('>=','1.2')], ()) + assert r != Requirement("Twisted", [('>=','2.0')], ()) + assert r != Requirement("Zope", [('>=','1.2')], ()) + assert r != Requirement("Zope", [('>=','3.0')], ()) + assert r != Requirement.parse("Twisted[extras]>=1.2") def testOrdering(self): r1 = Requirement("Twisted", [('==','1.2c1'),('>=','1.2')], ()) r2 = Requirement("Twisted", [('>=','1.2'),('==','1.2c1')], ()) - self.assertEqual(r1,r2) - self.assertEqual(str(r1),str(r2)) - self.assertEqual(str(r2),"Twisted==1.2c1,>=1.2") + assert r1 == r2 + assert str(r1) == str(r2) + assert str(r2) == "Twisted==1.2c1,>=1.2" def testBasicContains(self): r = Requirement("Twisted", [('>=','1.2')], ()) foo_dist = Distribution.from_filename("FooPkg-1.3_1.egg") twist11 = Distribution.from_filename("Twisted-1.1.egg") twist12 = Distribution.from_filename("Twisted-1.2.egg") - self.assertTrue(parse_version('1.2') in r) - self.assertTrue(parse_version('1.1') not in r) - self.assertTrue('1.2' in r) - self.assertTrue('1.1' not in r) - self.assertTrue(foo_dist not in r) - self.assertTrue(twist11 not in r) - self.assertTrue(twist12 in r) + assert parse_version('1.2') in r + assert parse_version('1.1') not in r + assert '1.2' in r + assert '1.1' not in r + assert foo_dist not in r + assert twist11 not in r + assert twist12 in r def testOptionsAndHashing(self): r1 = Requirement.parse("Twisted[foo,bar]>=1.2") r2 = Requirement.parse("Twisted[bar,FOO]>=1.2") - self.assertEqual(r1,r2) - self.assertEqual(r1.extras, ("foo","bar")) - self.assertEqual(r2.extras, ("bar","foo")) # extras are normalized - self.assertEqual(hash(r1), hash(r2)) - self.assertEqual( - hash(r1), hash(("twisted", packaging.specifiers.SpecifierSet(">=1.2"), - frozenset(["foo","bar"]))) + assert r1 == r2 + assert r1.extras == ("foo","bar") + assert r2.extras == ("bar","foo") # extras are normalized + assert hash(r1) == hash(r2) + assert ( + hash(r1) + == + hash(( + "twisted", + packaging.specifiers.SpecifierSet(">=1.2"), + frozenset(["foo","bar"]), + )) ) def testVersionEquality(self): @@ -350,42 +349,42 @@ class RequirementsTests(TestCase): r2 = Requirement.parse("foo!=0.3a4") d = Distribution.from_filename - self.assertTrue(d("foo-0.3a4.egg") not in r1) - self.assertTrue(d("foo-0.3a1.egg") not in r1) - self.assertTrue(d("foo-0.3a4.egg") not in r2) + assert d("foo-0.3a4.egg") not in r1 + assert d("foo-0.3a1.egg") not in r1 + assert d("foo-0.3a4.egg") not in r2 - self.assertTrue(d("foo-0.3a2.egg") in r1) - self.assertTrue(d("foo-0.3a2.egg") in r2) - self.assertTrue(d("foo-0.3a3.egg") in r2) - self.assertTrue(d("foo-0.3a5.egg") in r2) + assert d("foo-0.3a2.egg") in r1 + assert d("foo-0.3a2.egg") in r2 + assert d("foo-0.3a3.egg") in r2 + assert d("foo-0.3a5.egg") in r2 def testSetuptoolsProjectName(self): """ The setuptools project should implement the setuptools package. """ - self.assertEqual( - Requirement.parse('setuptools').project_name, 'setuptools') + assert ( + Requirement.parse('setuptools').project_name == 'setuptools') # setuptools 0.7 and higher means setuptools. - self.assertEqual( - Requirement.parse('setuptools == 0.7').project_name, 'setuptools') - self.assertEqual( - Requirement.parse('setuptools == 0.7a1').project_name, 'setuptools') - self.assertEqual( - Requirement.parse('setuptools >= 0.7').project_name, 'setuptools') + assert ( + Requirement.parse('setuptools == 0.7').project_name == 'setuptools') + assert ( + Requirement.parse('setuptools == 0.7a1').project_name == 'setuptools') + assert ( + Requirement.parse('setuptools >= 0.7').project_name == 'setuptools') -class ParseTests(TestCase): +class TestParsing: def testEmptyParse(self): - self.assertEqual(list(parse_requirements('')), []) + assert list(parse_requirements('')) == [] def testYielding(self): for inp,out in [ ([], []), ('x',['x']), ([[]],[]), (' x\n y', ['x','y']), (['x\n\n','y'], ['x','y']), ]: - self.assertEqual(list(pkg_resources.yield_lines(inp)),out) + assert list(pkg_resources.yield_lines(inp)) == out def testSplitting(self): sample = """ @@ -401,48 +400,65 @@ class ParseTests(TestCase): [q] v """ - self.assertEqual(list(pkg_resources.split_sections(sample)), - [(None,["x"]), ("Y",["z","a"]), ("b",["c"]), ("d",[]), ("q",["v"])] + assert ( + list(pkg_resources.split_sections(sample)) + == + [ + (None, ["x"]), + ("Y", ["z", "a"]), + ("b", ["c"]), + ("d", []), + ("q", ["v"]), + ] ) - self.assertRaises(ValueError,list,pkg_resources.split_sections("[foo")) + with pytest.raises(ValueError): + list(pkg_resources.split_sections("[foo")) def testSafeName(self): - self.assertEqual(safe_name("adns-python"), "adns-python") - self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils") - self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils") - self.assertEqual(safe_name("Money$$$Maker"), "Money-Maker") - self.assertNotEqual(safe_name("peak.web"), "peak-web") + assert safe_name("adns-python") == "adns-python" + assert safe_name("WSGI Utils") == "WSGI-Utils" + assert safe_name("WSGI Utils") == "WSGI-Utils" + assert safe_name("Money$$$Maker") == "Money-Maker" + assert safe_name("peak.web") != "peak-web" def testSafeVersion(self): - self.assertEqual(safe_version("1.2-1"), "1.2.post1") - self.assertEqual(safe_version("1.2 alpha"), "1.2.alpha") - self.assertEqual(safe_version("2.3.4 20050521"), "2.3.4.20050521") - self.assertEqual(safe_version("Money$$$Maker"), "Money-Maker") - self.assertEqual(safe_version("peak.web"), "peak.web") + assert safe_version("1.2-1") == "1.2.post1" + assert safe_version("1.2 alpha") == "1.2.alpha" + assert safe_version("2.3.4 20050521") == "2.3.4.20050521" + assert safe_version("Money$$$Maker") == "Money-Maker" + assert safe_version("peak.web") == "peak.web" def testSimpleRequirements(self): - self.assertEqual( - list(parse_requirements('Twis-Ted>=1.2-1')), + assert ( + list(parse_requirements('Twis-Ted>=1.2-1')) + == [Requirement('Twis-Ted',[('>=','1.2-1')], ())] ) - self.assertEqual( - list(parse_requirements('Twisted >=1.2, \ # more\n<2.0')), + assert ( + list(parse_requirements('Twisted >=1.2, \ # more\n<2.0')) + == [Requirement('Twisted',[('>=','1.2'),('<','2.0')], ())] ) - self.assertEqual( - Requirement.parse("FooBar==1.99a3"), + assert ( + Requirement.parse("FooBar==1.99a3") + == Requirement("FooBar", [('==','1.99a3')], ()) ) - self.assertRaises(ValueError,Requirement.parse,">=2.3") - self.assertRaises(ValueError,Requirement.parse,"x\\") - self.assertRaises(ValueError,Requirement.parse,"x==2 q") - self.assertRaises(ValueError,Requirement.parse,"X==1\nY==2") - self.assertRaises(ValueError,Requirement.parse,"#") + with pytest.raises(ValueError): + Requirement.parse(">=2.3") + with pytest.raises(ValueError): + Requirement.parse("x\\") + with pytest.raises(ValueError): + Requirement.parse("x==2 q") + with pytest.raises(ValueError): + Requirement.parse("X==1\nY==2") + with pytest.raises(ValueError): + Requirement.parse("#") def testVersionEquality(self): def c(s1,s2): p1, p2 = parse_version(s1),parse_version(s2) - self.assertEqual(p1,p2, (s1,s2,p1,p2)) + assert p1 == p2, (s1,s2,p1,p2) c('1.2-rc1', '1.2rc1') c('0.4', '0.4.0') @@ -458,7 +474,7 @@ class ParseTests(TestCase): def testVersionOrdering(self): def c(s1,s2): p1, p2 = parse_version(s1),parse_version(s2) - self.assertTrue(p1 tuple(parse_version("2.0"))) - self.assertTrue(parse_version("3.0") >= tuple(parse_version("2.0"))) - self.assertTrue(parse_version("3.0") != tuple(parse_version("2.0"))) - self.assertFalse(parse_version("3.0") != tuple(parse_version("3.0"))) + assert parse_version("1.0") < tuple(parse_version("2.0")) + assert parse_version("1.0") <= tuple(parse_version("2.0")) + assert parse_version("1.0") == tuple(parse_version("1.0")) + assert parse_version("3.0") > tuple(parse_version("2.0")) + assert parse_version("3.0") >= tuple(parse_version("2.0")) + assert parse_version("3.0") != tuple(parse_version("2.0")) + assert not (parse_version("3.0") != tuple(parse_version("3.0"))) def testVersionHashable(self): """ Ensure that our versions stay hashable even though we've subclassed them and added some shim code to them. """ - self.assertEqual( - hash(parse_version("1.0")), - hash(parse_version("1.0")), + assert ( + hash(parse_version("1.0")) + == + hash(parse_version("1.0")) ) -class ScriptHeaderTests(TestCase): +class TestScriptHeader: non_ascii_exe = '/Users/José/bin/python' exe_with_spaces = r'C:\Program Files\Python33\python.exe' @@ -546,17 +563,15 @@ class ScriptHeaderTests(TestCase): if not sys.platform.startswith('java') or not is_sh(sys.executable): # This test is for non-Jython platforms expected = '#!%s\n' % nt_quote_arg(os.path.normpath(sys.executable)) - self.assertEqual(get_script_header('#!/usr/local/bin/python'), - expected) + assert get_script_header('#!/usr/local/bin/python') == expected expected = '#!%s -x\n' % nt_quote_arg(os.path.normpath(sys.executable)) - self.assertEqual(get_script_header('#!/usr/bin/python -x'), - expected) - self.assertEqual(get_script_header('#!/usr/bin/python', - executable=self.non_ascii_exe), - '#!%s -x\n' % self.non_ascii_exe) + assert get_script_header('#!/usr/bin/python -x') == expected + candidate = get_script_header('#!/usr/bin/python', + executable=self.non_ascii_exe) + assert candidate == '#!%s -x\n' % self.non_ascii_exe candidate = get_script_header('#!/usr/bin/python', executable=self.exe_with_spaces) - self.assertEqual(candidate, '#!"%s"\n' % self.exe_with_spaces) + assert candidate == '#!"%s"\n' % self.exe_with_spaces def test_get_script_header_jython_workaround(self): # This test doesn't work with Python 3 in some locales @@ -577,38 +592,40 @@ class ScriptHeaderTests(TestCase): try: # A mock sys.executable that uses a shebang line (this file) exe = os.path.normpath(os.path.splitext(__file__)[0] + '.py') - self.assertEqual( - get_script_header('#!/usr/local/bin/python', executable=exe), - '#!/usr/bin/env %s\n' % exe) + assert ( + get_script_header('#!/usr/local/bin/python', executable=exe) + == + '#!/usr/bin/env %s\n' % exe + ) # Ensure we generate what is basically a broken shebang line # when there's options, with a warning emitted sys.stdout = sys.stderr = StringIO() - self.assertEqual(get_script_header('#!/usr/bin/python -x', - executable=exe), - '#!%s -x\n' % exe) - self.assertTrue('Unable to adapt shebang line' in sys.stdout.getvalue()) + candidate = get_script_header('#!/usr/bin/python -x', + executable=exe) + assert candidate == '#!%s -x\n' % exe + assert 'Unable to adapt shebang line' in sys.stdout.getvalue() sys.stdout = sys.stderr = StringIO() - self.assertEqual(get_script_header('#!/usr/bin/python', - executable=self.non_ascii_exe), - '#!%s -x\n' % self.non_ascii_exe) - self.assertTrue('Unable to adapt shebang line' in sys.stdout.getvalue()) + candidate = get_script_header('#!/usr/bin/python', + executable=self.non_ascii_exe) + assert candidate == '#!%s -x\n' % self.non_ascii_exe + assert 'Unable to adapt shebang line' in sys.stdout.getvalue() finally: del sys.modules["java"] sys.platform = platform sys.stdout, sys.stderr = stdout, stderr -class NamespaceTests(TestCase): +class TestNamespaces: - def setUp(self): + def setup_method(self, method): self._ns_pkgs = pkg_resources._namespace_packages.copy() self._tmpdir = tempfile.mkdtemp(prefix="tests-setuptools-") os.makedirs(os.path.join(self._tmpdir, "site-pkgs")) self._prev_sys_path = sys.path[:] sys.path.append(os.path.join(self._tmpdir, "site-pkgs")) - def tearDown(self): + def teardown_method(self, method): shutil.rmtree(self._tmpdir) pkg_resources._namespace_packages = self._ns_pkgs.copy() sys.path = self._prev_sys_path[:] -- cgit v1.2.1 From c3e74e46e20ceb7cc126f28611d0b9c098a333f2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:43:29 -0500 Subject: Ported test_sandbox to pytest from unittest. --- setuptools/tests/test_sandbox.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 6a890ebc..138e7f87 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -3,7 +3,6 @@ import sys import os import shutil -import unittest import tempfile import types @@ -24,12 +23,12 @@ def has_win32com(): return False return True -class TestSandbox(unittest.TestCase): +class TestSandbox: - def setUp(self): + def setup_method(self, method): self.dir = tempfile.mkdtemp() - def tearDown(self): + def teardown_method(self, method): shutil.rmtree(self.dir) def test_devnull(self): @@ -78,6 +77,3 @@ class TestSandbox(unittest.TestCase): with open(setup_py, 'wb') as stream: stream.write(b'"degenerate script"\r\n') setuptools.sandbox._execfile(setup_py, globals()) - -if __name__ == '__main__': - unittest.main() -- cgit v1.2.1 From 4837776968b41fd22d74e560f07e554fcff47d72 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:45:35 -0500 Subject: Use importorskip to detect/load win32com --- setuptools/tests/test_sandbox.py | 45 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 138e7f87..426c5614 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -6,22 +6,12 @@ import shutil import tempfile import types +import pytest + import pkg_resources import setuptools.sandbox from setuptools.sandbox import DirectorySandbox, SandboxViolation -def has_win32com(): - """ - Run this to determine if the local machine has win32com, and if it - does, include additional tests. - """ - if not sys.platform.startswith('win32'): - return False - try: - __import__('win32com') - except ImportError: - return False - return True class TestSandbox: @@ -44,23 +34,22 @@ class TestSandbox: _file_writer = staticmethod(_file_writer) - if has_win32com(): - def test_win32com(self): - """ - win32com should not be prevented from caching COM interfaces - in gen_py. - """ - import win32com - gen_py = win32com.__gen_path__ - target = os.path.join(gen_py, 'test_write') - sandbox = DirectorySandbox(self.dir) + def test_win32com(self): + """ + win32com should not be prevented from caching COM interfaces + in gen_py. + """ + win32com = pytest.importorskip('win32com') + gen_py = win32com.__gen_path__ + target = os.path.join(gen_py, 'test_write') + sandbox = DirectorySandbox(self.dir) + try: try: - try: - sandbox.run(self._file_writer(target)) - except SandboxViolation: - self.fail("Could not create gen_py file due to SandboxViolation") - finally: - if os.path.exists(target): os.remove(target) + sandbox.run(self._file_writer(target)) + except SandboxViolation: + self.fail("Could not create gen_py file due to SandboxViolation") + finally: + if os.path.exists(target): os.remove(target) def test_setup_py_with_BOM(self): """ -- cgit v1.2.1 From b96f9cd4b2832c4b70b23473dfed1e6f291dd119 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:47:54 -0500 Subject: Minor cleanup --- setuptools/tests/test_sandbox.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 426c5614..d09d164f 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -1,6 +1,5 @@ """develop tests """ -import sys import os import shutil import tempfile @@ -25,15 +24,13 @@ class TestSandbox: sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull)) + @staticmethod def _file_writer(path): def do_write(): - f = open(path, 'w') - f.write('xxx') - f.close() + with open(path, 'w') as f: + f.write('xxx') return do_write - _file_writer = staticmethod(_file_writer) - def test_win32com(self): """ win32com should not be prevented from caching COM interfaces @@ -49,7 +46,8 @@ class TestSandbox: except SandboxViolation: self.fail("Could not create gen_py file due to SandboxViolation") finally: - if os.path.exists(target): os.remove(target) + if os.path.exists(target): + os.remove(target) def test_setup_py_with_BOM(self): """ -- cgit v1.2.1 From 8b899dabec8d2f050e4a13dfc78ec4bcb5b620df Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:50:29 -0500 Subject: Use tmpdir fixture --- setuptools/tests/test_sandbox.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index d09d164f..6e5ce04a 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -1,8 +1,6 @@ """develop tests """ import os -import shutil -import tempfile import types import pytest @@ -14,14 +12,8 @@ from setuptools.sandbox import DirectorySandbox, SandboxViolation class TestSandbox: - def setup_method(self, method): - self.dir = tempfile.mkdtemp() - - def teardown_method(self, method): - shutil.rmtree(self.dir) - - def test_devnull(self): - sandbox = DirectorySandbox(self.dir) + def test_devnull(self, tmpdir): + sandbox = DirectorySandbox(str(tmpdir)) sandbox.run(self._file_writer(os.devnull)) @staticmethod @@ -31,7 +23,7 @@ class TestSandbox: f.write('xxx') return do_write - def test_win32com(self): + def test_win32com(self, tmpdir): """ win32com should not be prevented from caching COM interfaces in gen_py. @@ -39,7 +31,7 @@ class TestSandbox: win32com = pytest.importorskip('win32com') gen_py = win32com.__gen_path__ target = os.path.join(gen_py, 'test_write') - sandbox = DirectorySandbox(self.dir) + sandbox = DirectorySandbox(str(tmpdir)) try: try: sandbox.run(self._file_writer(target)) @@ -59,8 +51,8 @@ class TestSandbox: setuptools.sandbox._execfile(target, vars(namespace)) assert namespace.result == 'passed' - def test_setup_py_with_CRLF(self): - setup_py = os.path.join(self.dir, 'setup.py') - with open(setup_py, 'wb') as stream: + def test_setup_py_with_CRLF(self, tmpdir): + setup_py = tmpdir / 'setup.py' + with setup_py.open('wb') as stream: stream.write(b'"degenerate script"\r\n') - setuptools.sandbox._execfile(setup_py, globals()) + setuptools.sandbox._execfile(str(setup_py), globals()) -- cgit v1.2.1 From a6cfae4a1d1a0fb1c71b6fe353b9d1030417811a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:58:30 -0500 Subject: Converted sdist tests to pytest --- setuptools/tests/test_sdist.py | 55 +++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 120911d2..943a5dee 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -6,7 +6,6 @@ import os import shutil import sys import tempfile -import unittest import unicodedata import contextlib @@ -78,9 +77,9 @@ def decompose(path): return path -class TestSdistTest(unittest.TestCase): +class TestSdistTest: - def setUp(self): + def setup_method(self, method): self.temp_dir = tempfile.mkdtemp() f = open(os.path.join(self.temp_dir, 'setup.py'), 'w') f.write(SETUP_PY) @@ -98,7 +97,7 @@ class TestSdistTest(unittest.TestCase): self.old_cwd = os.getcwd() os.chdir(self.temp_dir) - def tearDown(self): + def teardown_method(self, method): os.chdir(self.old_cwd) shutil.rmtree(self.temp_dir) @@ -117,9 +116,9 @@ class TestSdistTest(unittest.TestCase): cmd.run() manifest = cmd.filelist.files - self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest) - self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest) - self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest) + assert os.path.join('sdist_test', 'a.txt') in manifest + assert os.path.join('sdist_test', 'b.txt') in manifest + assert os.path.join('sdist_test', 'c.rst') not in manifest def test_defaults_case_sensitivity(self): @@ -144,9 +143,9 @@ class TestSdistTest(unittest.TestCase): # lowercase all names so we can test in a case-insensitive way to make sure the files are not included manifest = map(lambda x: x.lower(), cmd.filelist.files) - self.assertFalse('readme.rst' in manifest, manifest) - self.assertFalse('setup.py' in manifest, manifest) - self.assertFalse('setup.cfg' in manifest, manifest) + assert 'readme.rst' not in manifest, manifest + assert 'setup.py' not in manifest, manifest + assert 'setup.cfg' not in manifest, manifest def test_manifest_is_written_with_utf8_encoding(self): # Test for #303. @@ -184,7 +183,7 @@ class TestSdistTest(unittest.TestCase): fs_enc = sys.getfilesystemencoding() filename = filename.decode(fs_enc) - self.assertTrue(posix(filename) in u_contents) + assert posix(filename) in u_contents # Python 3 only if PY3: @@ -223,10 +222,10 @@ class TestSdistTest(unittest.TestCase): self.fail(e) # The manifest should contain the UTF-8 filename - self.assertTrue(posix(filename) in contents) + assert posix(filename) in contents # The filelist should have been updated as well - self.assertTrue(u_filename in mm.filelist.files) + assert u_filename in mm.filelist.files def test_write_manifest_skips_non_utf8_filenames(self): """ @@ -264,10 +263,10 @@ class TestSdistTest(unittest.TestCase): self.fail(e) # The Latin-1 filename should have been skipped - self.assertFalse(posix(filename) in contents) + assert posix(filename) not in contents # The filelist should have been updated as well - self.assertFalse(u_filename in mm.filelist.files) + assert u_filename not in mm.filelist.files def test_manifest_is_read_with_utf8_encoding(self): # Test for #303. @@ -298,7 +297,7 @@ class TestSdistTest(unittest.TestCase): # The filelist should contain the UTF-8 filename if PY3: filename = filename.decode('utf-8') - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files # Python 3 only if PY3: @@ -335,7 +334,7 @@ class TestSdistTest(unittest.TestCase): # The Latin-1 filename should have been skipped filename = filename.decode('latin-1') - self.assertFalse(filename in cmd.filelist.files) + assert filename not in cmd.filelist.files @pytest.mark.skipif(PY3 and locale.getpreferredencoding() != 'UTF-8', reason='Unittest fails if locale is not utf-8 but the manifests is ' @@ -364,15 +363,15 @@ class TestSdistTest(unittest.TestCase): if fs_enc == 'cp1252': # Python 3 mangles the UTF-8 filename filename = filename.decode('cp1252') - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files else: filename = filename.decode('mbcs') - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files else: filename = filename.decode('utf-8') - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files else: - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files def test_sdist_with_latin1_encoded_filename(self): # Test for #303. @@ -384,7 +383,7 @@ class TestSdistTest(unittest.TestCase): # Latin-1 filename filename = os.path.join(b('sdist_test'), LATIN1_FILENAME) open(filename, 'w').close() - self.assertTrue(os.path.isfile(filename)) + assert os.path.isfile(filename) with quiet(): cmd.run() @@ -400,11 +399,11 @@ class TestSdistTest(unittest.TestCase): else: filename = filename.decode('latin-1') - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files else: # The Latin-1 filename should have been skipped filename = filename.decode('latin-1') - self.assertFalse(filename in cmd.filelist.files) + filename not in cmd.filelist.files else: # Under Python 2 there seems to be no decoded string in the # filelist. However, due to decode and encoding of the @@ -414,9 +413,9 @@ class TestSdistTest(unittest.TestCase): # be proformed for the manifest output. fs_enc = sys.getfilesystemencoding() filename.decode(fs_enc) - self.assertTrue(filename in cmd.filelist.files) + assert filename in cmd.filelist.files except UnicodeDecodeError: - self.assertFalse(filename in cmd.filelist.files) + filename not in cmd.filelist.files def test_default_revctrl(): @@ -434,7 +433,3 @@ def test_default_revctrl(): ep = pkg_resources.EntryPoint.parse(ep_def) res = ep._load() assert hasattr(res, '__iter__') - - -def test_suite(): - return unittest.defaultTestLoader.loadTestsFromName(__name__) -- cgit v1.2.1 From ee20548e4039df2a49157f5d85090286434ced5f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 11:58:58 -0500 Subject: Remove unused imports --- setuptools/tests/test_test.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index df92085e..edd1769a 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -9,10 +9,8 @@ import sys import tempfile import unittest -from distutils.errors import DistutilsError from setuptools.compat import StringIO, PY2 from setuptools.command.test import test -from setuptools.command import easy_install as easy_install_pkg from setuptools.dist import Distribution SETUP_PY = """\ -- cgit v1.2.1 From a974f8c7b1b30bdb462531627a39255a0b82fdff Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:00:11 -0500 Subject: Use DALS for nicer indentation --- setuptools/tests/test_test.py | 52 ++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index edd1769a..9a8f9313 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -13,37 +13,43 @@ from setuptools.compat import StringIO, PY2 from setuptools.command.test import test from setuptools.dist import Distribution -SETUP_PY = """\ -from setuptools import setup - -setup(name='foo', - packages=['name', 'name.space', 'name.space.tests'], - namespace_packages=['name'], - test_suite='name.space.tests.test_suite', -) -""" +from .textwrap import DALS + +SETUP_PY = DALS(""" + from setuptools import setup + + setup(name='foo', + packages=['name', 'name.space', 'name.space.tests'], + namespace_packages=['name'], + test_suite='name.space.tests.test_suite', + ) + """) + +NS_INIT = DALS(""" + # -*- coding: Latin-1 -*- + # Söme Arbiträry Ünicode to test Issüé 310 + try: + __import__('pkg_resources').declare_namespace(__name__) + except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) + """) -NS_INIT = """# -*- coding: Latin-1 -*- -# Söme Arbiträry Ünicode to test Issüé 310 -try: - __import__('pkg_resources').declare_namespace(__name__) -except ImportError: - from pkgutil import extend_path - __path__ = extend_path(__path__, __name__) -""" # Make sure this is Latin-1 binary, before writing: if PY2: NS_INIT = NS_INIT.decode('UTF-8') NS_INIT = NS_INIT.encode('Latin-1') -TEST_PY = """import unittest +TEST_PY = DALS(""" + import unittest -class TestTest(unittest.TestCase): - def test_test(self): - print "Foo" # Should fail under Python 3 unless 2to3 is used + class TestTest(unittest.TestCase): + def test_test(self): + print "Foo" # Should fail under Python 3 unless 2to3 is used + + test_suite = unittest.makeSuite(TestTest) + """) -test_suite = unittest.makeSuite(TestTest) -""" class TestTestTest(unittest.TestCase): -- cgit v1.2.1 From 14beff81f0f4369a3323a84f49d53747a38bccfd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:01:57 -0500 Subject: Port test_test to pytest --- setuptools/tests/test_test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 9a8f9313..f527aa24 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -7,7 +7,6 @@ import shutil import site import sys import tempfile -import unittest from setuptools.compat import StringIO, PY2 from setuptools.command.test import test @@ -51,9 +50,9 @@ TEST_PY = DALS(""" """) -class TestTestTest(unittest.TestCase): +class TestTestTest: - def setUp(self): + def setup_method(self, method): if sys.version < "2.6" or hasattr(sys, 'real_prefix'): return @@ -90,7 +89,7 @@ class TestTestTest(unittest.TestCase): self.old_site = site.USER_SITE site.USER_SITE = tempfile.mkdtemp() - def tearDown(self): + def teardown_method(self, method): if sys.version < "2.6" or hasattr(sys, 'real_prefix'): return -- cgit v1.2.1 From d66783b40a483c9edf6117d7ebbb49c18e00de17 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:02:52 -0500 Subject: Python 2.6 can be assumed --- setuptools/tests/test_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index f527aa24..abd0038b 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -53,7 +53,7 @@ TEST_PY = DALS(""" class TestTestTest: def setup_method(self, method): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if hasattr(sys, 'real_prefix'): return # Directory structure @@ -90,7 +90,7 @@ class TestTestTest: site.USER_SITE = tempfile.mkdtemp() def teardown_method(self, method): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if hasattr(sys, 'real_prefix'): return os.chdir(self.old_cwd) @@ -101,7 +101,7 @@ class TestTestTest: site.USER_SITE = self.old_site def test_test(self): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if hasattr(sys, 'real_prefix'): return dist = Distribution(dict( -- cgit v1.2.1 From f0eaf642ac52c02cc605ee1222bd143ef5f36623 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:06:51 -0500 Subject: Use skipif marker for real_prefix --- setuptools/tests/test_test.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index abd0038b..5d7b72ba 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -8,6 +8,8 @@ import site import sys import tempfile +import pytest + from setuptools.compat import StringIO, PY2 from setuptools.command.test import test from setuptools.dist import Distribution @@ -50,12 +52,10 @@ TEST_PY = DALS(""" """) +@pytest.mark.skipif('hasattr(sys, "real_prefix")') class TestTestTest: def setup_method(self, method): - if hasattr(sys, 'real_prefix'): - return - # Directory structure self.dir = tempfile.mkdtemp() os.mkdir(os.path.join(self.dir, 'name')) @@ -90,9 +90,6 @@ class TestTestTest: site.USER_SITE = tempfile.mkdtemp() def teardown_method(self, method): - if hasattr(sys, 'real_prefix'): - return - os.chdir(self.old_cwd) shutil.rmtree(self.dir) shutil.rmtree(site.USER_BASE) @@ -101,9 +98,6 @@ class TestTestTest: site.USER_SITE = self.old_site def test_test(self): - if hasattr(sys, 'real_prefix'): - return - dist = Distribution(dict( name='foo', packages=['name', 'name.space', 'name.space.tests'], -- cgit v1.2.1 From 6a5d120fa48b91f4e4cd78404f48daa8f97a2bc4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:08:30 -0500 Subject: Use context opener --- setuptools/tests/test_test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 5d7b72ba..aec9ec98 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -61,27 +61,27 @@ class TestTestTest: os.mkdir(os.path.join(self.dir, 'name')) os.mkdir(os.path.join(self.dir, 'name', 'space')) os.mkdir(os.path.join(self.dir, 'name', 'space', 'tests')) + # setup.py setup = os.path.join(self.dir, 'setup.py') - f = open(setup, 'wt') - f.write(SETUP_PY) - f.close() + with open(setup, 'wt') as f: + f.write(SETUP_PY) self.old_cwd = os.getcwd() + # name/__init__.py init = os.path.join(self.dir, 'name', '__init__.py') - f = open(init, 'wb') - f.write(NS_INIT) - f.close() + with open(init, 'wb') as f: + f.write(NS_INIT) + # name/space/__init__.py init = os.path.join(self.dir, 'name', 'space', '__init__.py') - f = open(init, 'wt') - f.write('#empty\n') - f.close() + with open(init, 'wt') as f: + f.write('#empty\n') + # name/space/tests/__init__.py init = os.path.join(self.dir, 'name', 'space', 'tests', '__init__.py') - f = open(init, 'wt') - f.write(TEST_PY) - f.close() + with open(init, 'wt') as f: + f.write(TEST_PY) os.chdir(self.dir) self.old_base = site.USER_BASE -- cgit v1.2.1 From f6684c70f00276cc1ffa5225e543fbf7d7de6e71 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:13:45 -0500 Subject: Use useroverride fixture --- setuptools/tests/test_test.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index aec9ec98..6d279e40 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -53,6 +53,7 @@ TEST_PY = DALS(""" @pytest.mark.skipif('hasattr(sys, "real_prefix")') +@pytest.mark.usefixture('useroverride') class TestTestTest: def setup_method(self, method): @@ -84,18 +85,10 @@ class TestTestTest: f.write(TEST_PY) os.chdir(self.dir) - self.old_base = site.USER_BASE - site.USER_BASE = tempfile.mkdtemp() - self.old_site = site.USER_SITE - site.USER_SITE = tempfile.mkdtemp() def teardown_method(self, method): os.chdir(self.old_cwd) shutil.rmtree(self.dir) - shutil.rmtree(site.USER_BASE) - shutil.rmtree(site.USER_SITE) - site.USER_BASE = self.old_base - site.USER_SITE = self.old_site def test_test(self): dist = Distribution(dict( -- cgit v1.2.1 From 2ebaaf2315395b99b6790717659cb26a25cb715f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:35:03 -0500 Subject: Replace setup/teardown with a shorter, more elegant fixture. --- setuptools/tests/test_test.py | 60 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 6d279e40..1f4a7dda 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -3,10 +3,8 @@ """develop tests """ import os -import shutil import site import sys -import tempfile import pytest @@ -52,44 +50,32 @@ TEST_PY = DALS(""" """) +@pytest.fixture +def sample_test(tmpdir_cwd): + os.makedirs('name/space/tests') + + # setup.py + with open('setup.py', 'wt') as f: + f.write(SETUP_PY) + + # name/__init__.py + with open('name/__init__.py', 'wb') as f: + f.write(NS_INIT) + + # name/space/__init__.py + with open('name/space/__init__.py', 'wt') as f: + f.write('#empty\n') + + # name/space/tests/__init__.py + with open('name/space/tests/__init__.py', 'wt') as f: + f.write(TEST_PY) + + @pytest.mark.skipif('hasattr(sys, "real_prefix")') -@pytest.mark.usefixture('useroverride') +@pytest.mark.usefixtures('user_override') +@pytest.mark.usefixtures('sample_test') class TestTestTest: - def setup_method(self, method): - # Directory structure - self.dir = tempfile.mkdtemp() - os.mkdir(os.path.join(self.dir, 'name')) - os.mkdir(os.path.join(self.dir, 'name', 'space')) - os.mkdir(os.path.join(self.dir, 'name', 'space', 'tests')) - - # setup.py - setup = os.path.join(self.dir, 'setup.py') - with open(setup, 'wt') as f: - f.write(SETUP_PY) - self.old_cwd = os.getcwd() - - # name/__init__.py - init = os.path.join(self.dir, 'name', '__init__.py') - with open(init, 'wb') as f: - f.write(NS_INIT) - - # name/space/__init__.py - init = os.path.join(self.dir, 'name', 'space', '__init__.py') - with open(init, 'wt') as f: - f.write('#empty\n') - - # name/space/tests/__init__.py - init = os.path.join(self.dir, 'name', 'space', 'tests', '__init__.py') - with open(init, 'wt') as f: - f.write(TEST_PY) - - os.chdir(self.dir) - - def teardown_method(self, method): - os.chdir(self.old_cwd) - shutil.rmtree(self.dir) - def test_test(self): dist = Distribution(dict( name='foo', -- cgit v1.2.1 From ea576715047f0b4356d2ee39ec7c603305db0e8a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:37:39 -0500 Subject: Use quiet context --- setuptools/tests/test_test.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 1f4a7dda..51c3a9b4 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -4,15 +4,15 @@ """ import os import site -import sys import pytest -from setuptools.compat import StringIO, PY2 +from setuptools.compat import PY2 from setuptools.command.test import test from setuptools.dist import Distribution from .textwrap import DALS +from . import contexts SETUP_PY = DALS(""" from setuptools import setup @@ -90,13 +90,10 @@ class TestTestTest: cmd.ensure_finalized() cmd.install_dir = site.USER_SITE cmd.user = 1 - old_stdout = sys.stdout - sys.stdout = StringIO() - try: - try: # try/except/finally doesn't work in Python 2.4, so we need nested try-statements. + with contexts.quiet(): + try: cmd.run() - except SystemExit: # The test runner calls sys.exit, stop that making an error. + except SystemExit: + # The test runner calls sys.exit; suppress the exception pass - finally: - sys.stdout = old_stdout -- cgit v1.2.1 From 23c128e6ba47135134c317f42f1f42426eb9ae78 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:44:43 -0500 Subject: Suppress exceptions in a context for clarity, brevity, and reuse. --- setuptools/tests/contexts.py | 8 ++++++++ setuptools/tests/test_test.py | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py index a604cd41..d06a333f 100644 --- a/setuptools/tests/contexts.py +++ b/setuptools/tests/contexts.py @@ -83,3 +83,11 @@ def save_user_site_setting(): yield saved finally: site.ENABLE_USER_SITE = saved + + +@contextlib.contextmanager +def suppress_exceptions(*excs): + try: + yield + except excs: + pass diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 51c3a9b4..41b7d078 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -91,9 +91,6 @@ class TestTestTest: cmd.install_dir = site.USER_SITE cmd.user = 1 with contexts.quiet(): - try: + # The test runner calls sys.exit + with contexts.suppress_exceptions(SystemExit): cmd.run() - except SystemExit: - # The test runner calls sys.exit; suppress the exception - pass - -- cgit v1.2.1 From adda5ac7b25a17843749f054e48bc36de4c54b72 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:45:38 -0500 Subject: Extract var --- setuptools/tests/test_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 41b7d078..f2b444f7 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -77,13 +77,14 @@ def sample_test(tmpdir_cwd): class TestTestTest: def test_test(self): - dist = Distribution(dict( + params = dict( name='foo', packages=['name', 'name.space', 'name.space.tests'], namespace_packages=['name'], test_suite='name.space.tests.test_suite', use_2to3=True, - )) + ) + dist = Distribution(params) dist.script_name = 'setup.py' cmd = test(dist) cmd.user = 1 -- cgit v1.2.1 From 69c864c159b9f960e8881f5a60d20453ad17a30f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:55:29 -0500 Subject: Use unicode literals to define files as text, and encode specifically when saving files. --- setuptools/tests/test_test.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index f2b444f7..4430e6ea 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -1,13 +1,12 @@ # -*- coding: UTF-8 -*- -"""develop tests -""" +from __future__ import unicode_literals + import os import site import pytest -from setuptools.compat import PY2 from setuptools.command.test import test from setuptools.dist import Distribution @@ -34,11 +33,6 @@ NS_INIT = DALS(""" __path__ = extend_path(__path__, __name__) """) -# Make sure this is Latin-1 binary, before writing: -if PY2: - NS_INIT = NS_INIT.decode('UTF-8') -NS_INIT = NS_INIT.encode('Latin-1') - TEST_PY = DALS(""" import unittest @@ -60,7 +54,7 @@ def sample_test(tmpdir_cwd): # name/__init__.py with open('name/__init__.py', 'wb') as f: - f.write(NS_INIT) + f.write(NS_INIT.encode('Latin-1')) # name/space/__init__.py with open('name/space/__init__.py', 'wt') as f: -- cgit v1.2.1 From 73dd2fa9592d68e037a27468c36fdf3b32e0e16f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:56:31 -0500 Subject: Update comment to reflect issue was reported in Distribute. --- setuptools/tests/test_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 4430e6ea..a66294c9 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -25,7 +25,7 @@ SETUP_PY = DALS(""" NS_INIT = DALS(""" # -*- coding: Latin-1 -*- - # Söme Arbiträry Ünicode to test Issüé 310 + # Söme Arbiträry Ünicode to test Distribute Issüé 310 try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: -- cgit v1.2.1 From 6f3dd242a7856fb7d6be2a59fccbab449367285b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:57:07 -0500 Subject: Normalize imports --- setuptools/tests/test_upload_docs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 769f16cc..a1bd835f 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -1,6 +1,13 @@ """build_ext tests """ -import sys, os, shutil, tempfile, unittest, site, zipfile +import sys +import os +import shutil +import tempfile +import unittest +import site +import zipfile + from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution -- cgit v1.2.1 From e97379a558d1134ae402a428cda975911ba7d9e7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:58:14 -0500 Subject: Use DALS --- setuptools/tests/test_upload_docs.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index a1bd835f..f4e43d7c 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -11,11 +11,16 @@ import zipfile from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution -SETUP_PY = """\ -from setuptools import setup +from .textwrap import DALS + + +SETUP_PY = DALS( + """ + from setuptools import setup + + setup(name='foo') + """) -setup(name='foo') -""" class TestUploadDocsTest(unittest.TestCase): def setUp(self): -- cgit v1.2.1 From 3c40f86c2e1fac7707b6a7f2a25920fbb74ee270 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:00:18 -0500 Subject: Remove dependence on unittest in test_upload_docs --- setuptools/tests/test_upload_docs.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index f4e43d7c..2d478866 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -4,7 +4,6 @@ import sys import os import shutil import tempfile -import unittest import site import zipfile @@ -22,8 +21,8 @@ SETUP_PY = DALS( """) -class TestUploadDocsTest(unittest.TestCase): - def setUp(self): +class TestUploadDocsTest: + def setup_method(self, method): self.dir = tempfile.mkdtemp() setup = os.path.join(self.dir, 'setup.py') f = open(setup, 'w') @@ -49,7 +48,7 @@ class TestUploadDocsTest(unittest.TestCase): self.old_site = site.USER_SITE site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp() - def tearDown(self): + def teardown_method(self, method): os.chdir(self.old_cwd) shutil.rmtree(self.dir) if sys.version >= "2.6": -- cgit v1.2.1 From ddbaa77c8f1ad3cbb42957f03707804b13863d18 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:01:03 -0500 Subject: Remove copy pasta --- setuptools/tests/test_upload_docs.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 2d478866..f7052e6e 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -1,5 +1,3 @@ -"""build_ext tests -""" import sys import os import shutil -- cgit v1.2.1 From 144cd7bb846c5bcbadf1676d5455a065de52419a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:06:33 -0500 Subject: Leverage fixtures for sample project and user_overrides. --- setuptools/tests/test_upload_docs.py | 53 ++++++++++++------------------------ 1 file changed, 18 insertions(+), 35 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index f7052e6e..9e85f0d6 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -1,10 +1,10 @@ -import sys import os import shutil import tempfile -import site import zipfile +import pytest + from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution @@ -19,41 +19,25 @@ SETUP_PY = DALS( """) -class TestUploadDocsTest: - def setup_method(self, method): - self.dir = tempfile.mkdtemp() - setup = os.path.join(self.dir, 'setup.py') - f = open(setup, 'w') +@pytest.fixture +def sample_project(tmpdir_cwd): + # setup.py + with open('setup.py', 'wt') as f: f.write(SETUP_PY) - f.close() - self.old_cwd = os.getcwd() - os.chdir(self.dir) - self.upload_dir = os.path.join(self.dir, 'build') - os.mkdir(self.upload_dir) + os.mkdir('build') - # A test document. - f = open(os.path.join(self.upload_dir, 'index.html'), 'w') + # A test document. + with open('build/index.html', 'w') as f: f.write("Hello world.") - f.close() - - # An empty folder. - os.mkdir(os.path.join(self.upload_dir, 'empty')) - - if sys.version >= "2.6": - self.old_base = site.USER_BASE - site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp() - self.old_site = site.USER_SITE - site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp() - - def teardown_method(self, method): - os.chdir(self.old_cwd) - shutil.rmtree(self.dir) - if sys.version >= "2.6": - shutil.rmtree(site.USER_BASE) - shutil.rmtree(site.USER_SITE) - site.USER_BASE = self.old_base - site.USER_SITE = self.old_site + + # An empty folder. + os.mkdir('build/empty') + + +@pytest.mark.usefixtures('sample_project') +@pytest.mark.usefixtures('user_override') +class TestUploadDocsTest: def test_create_zipfile(self): # Test to make sure zipfile creation handles common cases. @@ -62,8 +46,7 @@ class TestUploadDocsTest: dist = Distribution() cmd = upload_docs(dist) - cmd.upload_dir = self.upload_dir - cmd.target_dir = self.upload_dir + cmd.target_dir = cmd.upload_dir = 'build' tmp_dir = tempfile.mkdtemp() tmp_file = os.path.join(tmp_dir, 'foo.zip') try: -- cgit v1.2.1 From b72261b9a0c9e45c730eff86fae594428f6f932a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:07:41 -0500 Subject: Replace comment with clearer docstring. --- setuptools/tests/test_upload_docs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 9e85f0d6..6fe9e051 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -40,8 +40,10 @@ def sample_project(tmpdir_cwd): class TestUploadDocsTest: def test_create_zipfile(self): - # Test to make sure zipfile creation handles common cases. - # This explicitly includes a folder containing an empty folder. + """ + Ensure zipfile creation handles common cases, including a folder + containing an empty folder. + """ dist = Distribution() -- cgit v1.2.1 From a87442aab8bd8779b562043540c467ffffb4d581 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:09:46 -0500 Subject: Use tempdir context --- setuptools/tests/test_upload_docs.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 6fe9e051..66d06dc0 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -1,6 +1,4 @@ import os -import shutil -import tempfile import zipfile import pytest @@ -9,6 +7,7 @@ from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution from .textwrap import DALS +from . import contexts SETUP_PY = DALS( @@ -49,9 +48,8 @@ class TestUploadDocsTest: cmd = upload_docs(dist) cmd.target_dir = cmd.upload_dir = 'build' - tmp_dir = tempfile.mkdtemp() - tmp_file = os.path.join(tmp_dir, 'foo.zip') - try: + with contexts.tempdir() as tmp_dir: + tmp_file = os.path.join(tmp_dir, 'foo.zip') zip_file = cmd.create_zipfile(tmp_file) assert zipfile.is_zipfile(tmp_file) @@ -61,6 +59,3 @@ class TestUploadDocsTest: assert zip_file.namelist() == ['index.html'] zip_file.close() - finally: - shutil.rmtree(tmp_dir) - -- cgit v1.2.1 From 8aee42417b6635979dc0da1beba3eae4fc6c3c7c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:13:23 -0500 Subject: woh what? --- setuptools/tests/test_upload_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 66d06dc0..ea5c3587 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -54,7 +54,7 @@ class TestUploadDocsTest: assert zipfile.is_zipfile(tmp_file) - zip_file = zipfile.ZipFile(tmp_file) # woh... + zip_file = zipfile.ZipFile(tmp_file) assert zip_file.namelist() == ['index.html'] -- cgit v1.2.1 From afedfedb4669e8f4ab1677bdb71bb9895fb2dc13 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:14:31 -0500 Subject: Open zip file in context --- setuptools/tests/test_upload_docs.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index ea5c3587..85f6d864 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -54,8 +54,5 @@ class TestUploadDocsTest: assert zipfile.is_zipfile(tmp_file) - zip_file = zipfile.ZipFile(tmp_file) - - assert zip_file.namelist() == ['index.html'] - - zip_file.close() + with zipfile.ZipFile(tmp_file) as zip_file: + assert zip_file.namelist() == ['index.html'] -- cgit v1.2.1 From db80c8f857b0c4ff3a5ad02a59e6442629599914 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:19:13 -0500 Subject: Use closing for Python 2.6 compatibility --- setuptools/tests/test_upload_docs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 85f6d864..cc71cadb 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -1,5 +1,6 @@ import os import zipfile +import contextlib import pytest @@ -54,5 +55,5 @@ class TestUploadDocsTest: assert zipfile.is_zipfile(tmp_file) - with zipfile.ZipFile(tmp_file) as zip_file: + with contextlib.closing(zipfile.ZipFile(tmp_file)) as zip_file: assert zip_file.namelist() == ['index.html'] -- cgit v1.2.1 From 398440e9a878ed9a6dbd8843151bc08e4ba5059a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:24:45 -0500 Subject: Remove unittest dependency from test_msvc9compiler. --- setuptools/tests/test_msvc9compiler.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 2a117dc9..a1637941 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -8,7 +8,6 @@ finds the Visual C++ for Python package. import os import shutil import tempfile -import unittest import distutils.errors import pytest @@ -64,7 +63,7 @@ class MockReg: distutils.msvc9compiler.Reg.read_values = self.original_read_values -class TestMSVC9Compiler(unittest.TestCase): +class TestMSVC9Compiler: def test_find_vcvarsall_patch(self): mod_name = distutils.msvc9compiler.find_vcvarsall.__module__ @@ -77,7 +76,7 @@ class TestMSVC9Compiler(unittest.TestCase): # not find anything with contexts.environment(VS90COMNTOOLS=None): with MockReg(): - self.assertIsNone(find_vcvarsall(9.0)) + assert find_vcvarsall(9.0) is None expected = distutils.errors.DistutilsPlatformError with pytest.raises(expected) as exc: @@ -104,11 +103,11 @@ class TestMSVC9Compiler(unittest.TestCase): key_64: mock_installdir_2, } ): - self.assertEqual(mock_vcvarsall_bat_1, find_vcvarsall(9.0)) + assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) # Ensure we get the local machine value if it's there with MockReg(hkey_local_machine={key_32: mock_installdir_2}): - self.assertEqual(mock_vcvarsall_bat_2, find_vcvarsall(9.0)) + assert mock_vcvarsall_bat_2 == find_vcvarsall(9.0) # Ensure we prefer the 64-bit local machine key # (*not* the Wow6432Node key) @@ -120,7 +119,7 @@ class TestMSVC9Compiler(unittest.TestCase): key_64: mock_installdir_2, } ): - self.assertEqual(mock_vcvarsall_bat_1, find_vcvarsall(9.0)) + assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) finally: shutil.rmtree(mock_installdir_1) shutil.rmtree(mock_installdir_2) -- cgit v1.2.1 From ed24bfcd1c3b9b7d83e433152c85dd6400edb4e6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:43:18 -0500 Subject: Use mock to patch msvc9compiler.Reg. --- setuptools/tests/test_msvc9compiler.py | 90 +++++++++++++++++----------------- 1 file changed, 44 insertions(+), 46 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index a1637941..9ed23e38 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -11,6 +11,7 @@ import tempfile import distutils.errors import pytest +import mock from . import contexts @@ -19,48 +20,41 @@ __import__('setuptools') pytest.importorskip("distutils.msvc9compiler") -class MockReg: - """Mock for distutils.msvc9compiler.Reg. We patch it - with an instance of this class that mocks out the - functions that access the registry. - """ - - def __init__(self, hkey_local_machine={}, hkey_current_user={}): - self.hklm = hkey_local_machine - self.hkcu = hkey_current_user - - def __enter__(self): - self.original_read_keys = distutils.msvc9compiler.Reg.read_keys - self.original_read_values = distutils.msvc9compiler.Reg.read_values - - _winreg = getattr(distutils.msvc9compiler, '_winreg', None) - winreg = getattr(distutils.msvc9compiler, 'winreg', _winreg) - hives = { - winreg.HKEY_CURRENT_USER: self.hkcu, - winreg.HKEY_LOCAL_MACHINE: self.hklm, - } +def mock_reg(hkcu=None, hklm=None): + """ + Return a mock for distutils.msvc9compiler.Reg, patched + to mock out the functions that access the registry. + """ - def read_keys(cls, base, key): - """Return list of registry keys.""" - hive = hives.get(base, {}) - return [k.rpartition('\\')[2] - for k in hive if k.startswith(key.lower())] + _winreg = getattr(distutils.msvc9compiler, '_winreg', None) + winreg = getattr(distutils.msvc9compiler, 'winreg', _winreg) - def read_values(cls, base, key): - """Return dict of registry keys and values.""" - hive = hives.get(base, {}) - return dict((k.rpartition('\\')[2], hive[k]) - for k in hive if k.startswith(key.lower())) + hives = { + winreg.HKEY_CURRENT_USER: hkcu or {}, + winreg.HKEY_LOCAL_MACHINE: hklm or {}, + } - distutils.msvc9compiler.Reg.read_keys = classmethod(read_keys) - distutils.msvc9compiler.Reg.read_values = classmethod(read_values) + @classmethod + def read_keys(cls, base, key): + """Return list of registry keys.""" + hive = hives.get(base, {}) + return [ + k.rpartition('\\')[2] + for k in hive if k.startswith(key.lower()) + ] - return self + @classmethod + def read_values(cls, base, key): + """Return dict of registry keys and values.""" + hive = hives.get(base, {}) + return dict( + (k.rpartition('\\')[2], hive[k]) + for k in hive if k.startswith(key.lower()) + ) - def __exit__(self, exc_type, exc_value, exc_tb): - distutils.msvc9compiler.Reg.read_keys = self.original_read_keys - distutils.msvc9compiler.Reg.read_values = self.original_read_values + return mock.patch.multiple(distutils.msvc9compiler.Reg, + read_keys=read_keys, read_values=read_values) class TestMSVC9Compiler: @@ -75,7 +69,7 @@ class TestMSVC9Compiler: # No registry entries or environment variable means we should # not find anything with contexts.environment(VS90COMNTOOLS=None): - with MockReg(): + with mock_reg(): assert find_vcvarsall(9.0) is None expected = distutils.errors.DistutilsPlatformError @@ -96,29 +90,33 @@ class TestMSVC9Compiler: open(mock_vcvarsall_bat_2, 'w').close() try: # Ensure we get the current user's setting first - with MockReg( - hkey_current_user={key_32: mock_installdir_1}, - hkey_local_machine={ + reg = mock_reg( + hkcu={ + key_32: mock_installdir_1, + }, + hklm={ key_32: mock_installdir_2, key_64: mock_installdir_2, - } - ): + }, + ) + with reg: assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) # Ensure we get the local machine value if it's there - with MockReg(hkey_local_machine={key_32: mock_installdir_2}): + with mock_reg(hklm={key_32: mock_installdir_2}): assert mock_vcvarsall_bat_2 == find_vcvarsall(9.0) # Ensure we prefer the 64-bit local machine key # (*not* the Wow6432Node key) - with MockReg( - hkey_local_machine={ + reg = mock_reg( + hklm={ # This *should* only exist on 32-bit machines key_32: mock_installdir_1, # This *should* only exist on 64-bit machines key_64: mock_installdir_2, } - ): + ) + with reg: assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) finally: shutil.rmtree(mock_installdir_1) -- cgit v1.2.1 From fb125b61118422a32af19e8cc88eccd13aed14f8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:46:30 -0500 Subject: Split test into two --- setuptools/tests/test_msvc9compiler.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 9ed23e38..02790ae7 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -77,6 +77,8 @@ class TestMSVC9Compiler: query_vcvarsall(9.0) assert 'aka.ms/vcpython27' in str(exc) + def test_find_vcvarsall_patch_2(self): + find_vcvarsall = distutils.msvc9compiler.find_vcvarsall key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' -- cgit v1.2.1 From 5485e8bacd95d03f1ee45343a1ae3afec2ecd882 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 13:49:15 -0500 Subject: Split the first test into two more tests. --- setuptools/tests/test_msvc9compiler.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 02790ae7..fd344678 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -57,17 +57,21 @@ def mock_reg(hkcu=None, hklm=None): read_keys=read_keys, read_values=read_values) -class TestMSVC9Compiler: +class TestModulePatch: - def test_find_vcvarsall_patch(self): + def test_patched(self): + "Test the module is actually patched" mod_name = distutils.msvc9compiler.find_vcvarsall.__module__ assert mod_name == "setuptools.msvc9_support", "find_vcvarsall unpatched" + def test_no_registry_entryies_means_nothing_found(self): + """ + No registry entries or environment variable should lead to an error + directing the user to download vcpython27. + """ find_vcvarsall = distutils.msvc9compiler.find_vcvarsall query_vcvarsall = distutils.msvc9compiler.query_vcvarsall - # No registry entries or environment variable means we should - # not find anything with contexts.environment(VS90COMNTOOLS=None): with mock_reg(): assert find_vcvarsall(9.0) is None -- cgit v1.2.1 From 2604aac7bb9e9b38546557fc2baaec98057d5740 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 14:22:33 -0500 Subject: Extract three more tests, using fixtures to unify the common aspects. --- setuptools/tests/test_msvc9compiler.py | 124 ++++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 41 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index fd344678..918f8898 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -6,8 +6,7 @@ finds the Visual C++ for Python package. """ import os -import shutil -import tempfile +import contextlib import distutils.errors import pytest @@ -59,6 +58,9 @@ def mock_reg(hkcu=None, hklm=None): class TestModulePatch: + key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' + key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' + def test_patched(self): "Test the module is actually patched" mod_name = distutils.msvc9compiler.find_vcvarsall.__module__ @@ -81,49 +83,89 @@ class TestModulePatch: query_vcvarsall(9.0) assert 'aka.ms/vcpython27' in str(exc) - def test_find_vcvarsall_patch_2(self): - find_vcvarsall = distutils.msvc9compiler.find_vcvarsall - key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' - key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' - - # Make two mock files so we can tell whether HCKU entries are - # preferred to HKLM entries. - mock_installdir_1 = tempfile.mkdtemp() - mock_vcvarsall_bat_1 = os.path.join(mock_installdir_1, 'vcvarsall.bat') - open(mock_vcvarsall_bat_1, 'w').close() - mock_installdir_2 = tempfile.mkdtemp() - mock_vcvarsall_bat_2 = os.path.join(mock_installdir_2, 'vcvarsall.bat') - open(mock_vcvarsall_bat_2, 'w').close() - try: - # Ensure we get the current user's setting first + @pytest.yield_fixture + def user_preferred_setting(self): + """ + Set up environment with different install dirs for user vs. system + and yield the user_install_dir for the expected result. + """ + with self.mock_install_dir() as user_install_dir: + with self.mock_install_dir() as system_install_dir: + reg = mock_reg( + hkcu={ + self.key_32: user_install_dir, + }, + hklm={ + self.key_32: system_install_dir, + self.key_64: system_install_dir, + }, + ) + with reg: + yield user_install_dir + + def test_prefer_current_user(self, user_preferred_setting): + """ + Ensure user's settings are preferred. + """ + result = distutils.msvc9compiler.find_vcvarsall(9.0) + assert user_preferred_setting == result + + @pytest.yield_fixture + def local_machine_setting(self): + """ + Set up environment with only the system environment configured. + """ + with self.mock_install_dir() as system_install_dir: reg = mock_reg( - hkcu={ - key_32: mock_installdir_1, - }, hklm={ - key_32: mock_installdir_2, - key_64: mock_installdir_2, + self.key_32: system_install_dir, }, ) with reg: - assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) + yield system_install_dir - # Ensure we get the local machine value if it's there - with mock_reg(hklm={key_32: mock_installdir_2}): - assert mock_vcvarsall_bat_2 == find_vcvarsall(9.0) + def test_local_machine_recognized(self, local_machine_setting): + """ + Ensure machine setting is honored if user settings are not present. + """ + result = distutils.msvc9compiler.find_vcvarsall(9.0) + assert local_machine_setting == result - # Ensure we prefer the 64-bit local machine key - # (*not* the Wow6432Node key) - reg = mock_reg( - hklm={ - # This *should* only exist on 32-bit machines - key_32: mock_installdir_1, - # This *should* only exist on 64-bit machines - key_64: mock_installdir_2, - } - ) - with reg: - assert mock_vcvarsall_bat_1 == find_vcvarsall(9.0) - finally: - shutil.rmtree(mock_installdir_1) - shutil.rmtree(mock_installdir_2) + @pytest.yield_fixture + def x64_preferred_setting(self): + """ + Set up environment with 64-bit and 32-bit system settings configured + and yield the 64-bit location. + """ + with self.mock_install_dir() as x32_dir: + with self.mock_install_dir() as x64_dir: + reg = mock_reg( + hklm={ + # This *should* only exist on 32-bit machines + self.key_32: x32_dir, + # This *should* only exist on 64-bit machines + self.key_64: x64_dir, + }, + ) + with reg: + yield x64_dir + + def test_ensure_64_bit_preferred(self, x64_preferred_setting): + """ + Ensure 64-bit system key is preferred. + """ + result = distutils.msvc9compiler.find_vcvarsall(9.0) + assert x64_preferred_setting == result + + @staticmethod + @contextlib.contextmanager + def mock_install_dir(): + """ + Make a mock install dir in a unique location so that tests can + distinguish which dir was detected in a given scenario. + """ + with contexts.tempdir() as result: + vcvarsall = os.path.join(result, 'vcvarsall.bat') + with open(vcvarsall, 'w'): + pass + yield -- cgit v1.2.1 From 91754ae31f631bb8bf4e9717799730be07a6331b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 14:25:21 -0500 Subject: Move docstring to test class. --- setuptools/tests/test_msvc9compiler.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_msvc9compiler.py b/setuptools/tests/test_msvc9compiler.py index 918f8898..a0820fff 100644 --- a/setuptools/tests/test_msvc9compiler.py +++ b/setuptools/tests/test_msvc9compiler.py @@ -1,8 +1,5 @@ -"""msvc9compiler monkey patch test - -This test ensures that importing setuptools is sufficient to replace -the standard find_vcvarsall function with our patched version that -finds the Visual C++ for Python package. +""" +Tests for msvc9compiler. """ import os @@ -57,6 +54,11 @@ def mock_reg(hkcu=None, hklm=None): class TestModulePatch: + """ + Ensure that importing setuptools is sufficient to replace + the standard find_vcvarsall function with a version that + recognizes the "Visual C++ for Python" package. + """ key_32 = r'software\microsoft\devdiv\vcforpython\9.0\installdir' key_64 = r'software\wow6432node\microsoft\devdiv\vcforpython\9.0\installdir' -- cgit v1.2.1 From 0c8f0cb4bfe39fd7840c0242dd059269c0266445 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 14:29:29 -0500 Subject: Bumped to 10.3 in preparation for next release. --- setuptools/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/version.py b/setuptools/version.py index 6b917706..fb86d074 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '10.2' +__version__ = '10.3' -- cgit v1.2.1 From ef428d7278002b558541300fb7b7a96c8dbac830 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 16:45:16 -0500 Subject: Move tests to be adjacent with other parsing tests. --- setuptools/tests/test_resources.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'setuptools') diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index ecd45bca..94370ff1 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -250,6 +250,11 @@ class TestEntryPoints: assert ep.attrs == ("foo",) assert ep.extras == () + # plus in the name + spec = "html+mako = mako.ext.pygmentplugin:MakoHtmlLexer" + ep = EntryPoint.parse(spec) + assert ep.name == 'html+mako' + def testRejects(self): for ep in [ "foo", "x=1=2", "x=a:b:c", "q=x/na", "fez=pish:tush-z", "x=f[a]>2", -- cgit v1.2.1 From a1fab3a5fd6bc0ed9b40885fbcfe7ba199f95493 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 16:45:48 -0500 Subject: Bumped to 10.2.1 in preparation for next release. --- setuptools/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/version.py b/setuptools/version.py index fb86d074..0e655f8a 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '10.3' +__version__ = '10.2.1' -- cgit v1.2.1 From 1ec7cafa9e8c8ea06adc582078444df886896830 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 16:46:29 -0500 Subject: Bumped to 10.2.2 in preparation for next release. --- setuptools/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/version.py b/setuptools/version.py index 0e655f8a..addf63a6 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '10.2.1' +__version__ = '10.2.2' -- cgit v1.2.1