Skip to content

Commit

Permalink
Setuptools now uses the 'packaging' package from pkg_resources, unify…
Browse files Browse the repository at this point in the history
…ing the behavior around resolution of that package.
  • Loading branch information
jaraco committed Dec 24, 2014
1 parent 9063c16 commit 170657b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
11 changes: 8 additions & 3 deletions pkg_resources/__init__.py
Expand Up @@ -75,9 +75,14 @@
except ImportError:
pass

import pkg_resources._vendor.packaging.version
import pkg_resources._vendor.packaging.specifiers
packaging = pkg_resources._vendor.packaging
try:
import packaging.version
import packaging.specifiers
except ImportError:
# fallback to vendored version
import pkg_resources._vendor.packaging.version
import pkg_resources._vendor.packaging.specifiers
packaging = pkg_resources._vendor.packaging


class PEP440Warning(RuntimeWarning):
Expand Down
8 changes: 1 addition & 7 deletions setuptools/command/egg_info.py
Expand Up @@ -11,13 +11,6 @@
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
Expand All @@ -28,6 +21,7 @@
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"
Expand Down
9 changes: 2 additions & 7 deletions setuptools/dist.py
Expand Up @@ -13,18 +13,13 @@
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
Expand Down
6 changes: 2 additions & 4 deletions setuptools/tests/test_resources.py
Expand Up @@ -8,15 +8,13 @@
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
Expand Down

0 comments on commit 170657b

Please sign in to comment.