summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgtags1
-rw-r--r--CHANGES.txt9
-rw-r--r--ez_setup.py2
-rw-r--r--pkg_resources/__init__.py59
-rwxr-xr-xsetuptools/command/egg_info.py3
-rwxr-xr-xsetuptools/package_index.py7
-rw-r--r--setuptools/version.py2
7 files changed, 54 insertions, 29 deletions
diff --git a/.hgtags b/.hgtags
index ff5c6433..07885aa3 100644
--- a/.hgtags
+++ b/.hgtags
@@ -204,3 +204,4 @@ a3a105f795f8362f26e84e9acbc237ee2d6bcca4 14.0
07fcc3226782b979cedaaf456c7f1c5b2fdafd2c 14.1.1
d714fb731de779a1337d2d78cd413931f1f06193 14.2
e3c635a7d463c7713c647d1aa560f83fd8e27ef0 14.3
+608948cef7e0ab8951691b149f5b6f0184a5635e 14.3.1
diff --git a/CHANGES.txt b/CHANGES.txt
index fa161fc6..018407fa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,15 @@
CHANGES
=======
+------
+14.3.1
+------
+
+* Issue #307: Removed PEP-440 warning during parsing of versions
+ in ``pkg_resources.Distribution``.
+* Issue #364: Replace deprecated usage with recommended usage of
+ ``EntryPoint.load``.
+
----
14.3
----
diff --git a/ez_setup.py b/ez_setup.py
index c8549761..683aeef4 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -30,7 +30,7 @@ try:
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "14.4"
+DEFAULT_VERSION = "14.3.2"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
DEFAULT_SAVE_DIR = os.curdir
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 6f1ab9b7..a8a16942 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -36,6 +36,7 @@ import collections
import plistlib
import email.parser
import tempfile
+import textwrap
from pkgutil import get_importer
PY3 = sys.version_info > (3,)
@@ -2286,9 +2287,16 @@ OBRACKET = re.compile(r"\s*\[").match
CBRACKET = re.compile(r"\s*\]").match
MODULE = re.compile(r"\w+(\.\w+)*$").match
EGG_NAME = re.compile(
- r"(?P<name>[^-]+)"
- r"( -(?P<ver>[^-]+) (-py(?P<pyver>[^-]+) (-(?P<plat>.+))? )? )?",
- re.VERBOSE | re.IGNORECASE
+ r"""
+ (?P<name>[^-]+) (
+ -(?P<ver>[^-]+) (
+ -py(?P<pyver>[^-]+) (
+ -(?P<plat>.+)
+ )?
+ )?
+ )?
+ """,
+ re.VERBOSE | re.IGNORECASE,
).match
@@ -2511,28 +2519,35 @@ class Distribution(object):
def parsed_version(self):
if not hasattr(self, "_parsed_version"):
self._parsed_version = parse_version(self.version)
- if isinstance(
- self._parsed_version, packaging.version.LegacyVersion):
- # While an empty version is techincally a legacy version and
- # is not a valid PEP 440 version, it's also unlikely to
- # actually come from someone and instead it is more likely that
- # it comes from setuptools attempting to parse a filename and
- # including it in the list. So for that we'll gate this warning
- # on if the version is anything at all or not.
- if self.version:
- warnings.warn(
- "'%s (%s)' is being parsed as a legacy, non PEP 440, "
- "version. You may find odd behavior and sort order. "
- "In particular it will be sorted as less than 0.0. It "
- "is recommend to migrate to PEP 440 compatible "
- "versions." % (
- self.project_name, self.version,
- ),
- PEP440Warning,
- )
return self._parsed_version
+ def _warn_legacy_version(self):
+ LV = packaging.version.LegacyVersion
+ is_legacy = isinstance(self._parsed_version, LV)
+ if not is_legacy:
+ return
+
+ # While an empty version is techincally a legacy version and
+ # is not a valid PEP 440 version, it's also unlikely to
+ # actually come from someone and instead it is more likely that
+ # it comes from setuptools attempting to parse a filename and
+ # including it in the list. So for that we'll gate this warning
+ # on if the version is anything at all or not.
+ if not self.version:
+ return
+
+ tmpl = textwrap.dedent("""
+ '{project_name} ({version})' is being parsed as a legacy,
+ non PEP 440,
+ version. You may find odd behavior and sort order.
+ In particular it will be sorted as less than 0.0. It
+ is recommend to migrate to PEP 440 compatible
+ versions.
+ """).strip().replace('\n', ' ')
+
+ warnings.warn(tmpl.format(**vars(self)), PEP440Warning)
+
@property
def version(self):
try:
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index a9940677..50f3d5c0 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -168,7 +168,8 @@ class egg_info(Command):
self.mkpath(self.egg_info)
installer = self.distribution.fetch_build_egg
for ep in iter_entry_points('egg_info.writers'):
- writer = ep.load(installer=installer)
+ ep.require(installer=installer)
+ writer = ep.resolve()
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
# Get rid of native_libs.txt if it was put there by older bdist_egg
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 5ed19130..cabf1039 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -138,10 +138,9 @@ def interpret_distro_name(
# versions in distribution archive names (sdist and bdist).
parts = basename.split('-')
- if not py_version:
- for i,p in enumerate(parts[2:]):
- if len(p)==5 and p.startswith('py2.'):
- return # It's a bdist_dumb, not an sdist -- bail out
+ if not py_version and any(re.match('py\d\.\d$', p) for p in parts[2:]):
+ # it is a bdist_dumb, not an sdist -- bail out
+ return
for p in range(1,len(parts)+1):
yield Distribution(
diff --git a/setuptools/version.py b/setuptools/version.py
index 5b9a2bc6..a2f34e92 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '14.4'
+__version__ = '14.3.2'