Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure packaging dependency is self-contained. #355

Merged
merged 1 commit into from
Jan 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Release Notes
=============

1.2.1
-----

This release is a quick fix for a bootstrapping bug that inadvertently went out in 1.2.0 (Issue
#354).

* Ensure `packaging` dependency is self-contained. (#355)
`#355 <https://github.com/pantsbuild/pex/pull/355>`_
`Fixes #354 <https://github.com/pantsbuild/pex/issues/354>`_

1.2.0
-----

Expand Down
14 changes: 4 additions & 10 deletions pex/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import os

from packaging.specifiers import SpecifierSet
from pkg_resources import EGG_NAME, parse_version, safe_name, safe_version

from .archiver import Archiver
Expand Down Expand Up @@ -80,15 +79,10 @@ def satisfies(self, requirement, allow_prereleases=False):
link_name = safe_name(self.name).lower()
if link_name != requirement.key:
return False

# TODO(John Sirois): This is a bit roundabout. Modern setuptools `Requirement` objects expose a
# `specifiers` field which is a `SpecifierSet`, but we can't be sure we have that. We can be
# sure though we have the `Requirement.specs` list of `(op, version)` tuples in all versions of
# setuptools we depend upon (we use `Requirement.specs` elsewhere in the codebase as well).
# Kill this re-parsing once our lower-bound setuptools dependency give access to
# `Requirement.specifiers`.
specifiers = ','.join(op + version for op, version in requirement.specs)
return self.raw_version in SpecifierSet(specifiers, prereleases=allow_prereleases)
# NB: If we upgrade to setuptools>=34 the SpecifierSet used here (requirement.specifier) will
# come from a non-vendored `packaging` package and pex's bootstrap code in `PEXBuilder` will
# need an update.
return requirement.specifier.contains(self.raw_version, prereleases=allow_prereleases)

def compatible(self, identity, platform=Platform.current()):
"""Is this link compatible with the given :class:`PythonIdentity` identity and platform?
Expand Down
7 changes: 5 additions & 2 deletions pex/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

__version__ = '1.2.0'
__version__ = '1.2.1'

PACKAGING_REQUIREMENT = 'packaging>=16.8,<17.0'
# NB: If we upgrade to setuptools>=34 pex's bootstrap code in `PEXBuilder` will need an update to
# include the `packaging` package in the `.bootstrap/` code since we use
# `packaging.specifiers.SpecifierSet` - indirectly - through `pkg_resources.Requirement.specifier`.
SETUPTOOLS_REQUIREMENT = 'setuptools>=20.0,<34.0'

WHEEL_REQUIREMENT = 'wheel>=0.26.0,<0.30.0'
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
'pex.commands',
],
install_requires = [
PACKAGING_REQUIREMENT,
SETUPTOOLS_REQUIREMENT,
],
tests_require = [
Expand Down