Skip to content

Commit

Permalink
Upgrade all vendored projects except pip. (pex-tool#1107)
Browse files Browse the repository at this point in the history
The motivation is improvements to tag handling across the board and
opening the door for treating PEXes as repositories to resolve from.

Work towards pex-tool#1108.
  • Loading branch information
jsirois authored Nov 9, 2020
1 parent 668d5f1 commit 8460d6e
Show file tree
Hide file tree
Showing 53 changed files with 2,369 additions and 459 deletions.
10 changes: 6 additions & 4 deletions pex/vendor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ def iter_vendor_specs():
:return: An iterator over specs of all vendored code.
:rtype: :class:`collection.Iterator` of :class:`VendorSpec`
"""
# We use this via pex.third_party at runtime to check for compatible wheel tags.
yield VendorSpec.pinned("packaging", "19.2")
# We use this via pex.third_party at runtime to check for compatible wheel tags and at build
# time to implement resolving distributions from a PEX repository.
yield VendorSpec.pinned("packaging", "20.4")

# We shell out to pip at buildtime to resolve and install dependencies.
# N.B.: This is pip 20.0.dev0 with a patch to support foreign download targets more fully.
Expand All @@ -116,10 +117,11 @@ def iter_vendor_specs():

# We expose this to pip at buildtime for legacy builds, but we also use pkg_resources via
# pex.third_party at runtime in various ways.
yield VendorSpec.pinned("setuptools", "42.0.2")
# N.B.: 44.0.0 is the last setuptools version compatible with Python 2.
yield VendorSpec.pinned("setuptools", "44.0.0")

# We expose this to pip at buildtime for legacy builds.
yield VendorSpec.pinned("wheel", "0.33.6", rewrite=False)
yield VendorSpec.pinned("wheel", "0.35.1", rewrite=False)


def vendor_runtime(chroot, dest_basedir, label, root_module_names):
Expand Down
2 changes: 1 addition & 1 deletion pex/vendor/_vendored/packaging/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packaging==19.2
packaging==20.4
pyparsing==2.4.7
six==1.15.0
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Metadata-Version: 2.1
Name: packaging
Version: 19.2
Version: 20.4
Summary: Core utilities for Python packages
Home-page: https://github.com/pypa/packaging
Author: Donald Stufft and individual contributors
Author-email: [email protected]
License: BSD or Apache License, Version 2.0
License: BSD-2-Clause or Apache-2.0
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Expand All @@ -19,6 +19,9 @@ Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
Description-Content-Type: text/x-rst
Requires-Dist: pyparsing (>=2.0.2)
Expand Down Expand Up @@ -92,6 +95,50 @@ recent changes and project history.
Changelog
---------

20.4 - 2020-05-19
~~~~~~~~~~~~~~~~~

* Canonicalize version before comparing specifiers. (`#282 <https://github.com/pypa/packaging/issues/282>`__)
* Change type hint for ``canonicalize_name`` to return
``packaging.utils.NormalizedName``.
This enables the use of static typing tools (like mypy) to detect mixing of
normalized and un-normalized names.

20.3 - 2020-03-05
~~~~~~~~~~~~~~~~~

* Fix changelog for 20.2.

20.2 - 2020-03-05
~~~~~~~~~~~~~~~~~

* Fix a bug that caused a 32-bit OS that runs on a 64-bit ARM CPU (e.g. ARM-v8,
aarch64), to report the wrong bitness.

20.1 - 2020-01-24
~~~~~~~~~~~~~~~~~~~

* Fix a bug caused by reuse of an exhausted iterator. (`#257 <https://github.com/pypa/packaging/issues/257>`__)

20.0 - 2020-01-06
~~~~~~~~~~~~~~~~~

* Add type hints (`#191 <https://github.com/pypa/packaging/issues/191>`__)

* Add proper trove classifiers for PyPy support (`#198 <https://github.com/pypa/packaging/issues/198>`__)

* Scale back depending on ``ctypes`` for manylinux support detection (`#171 <https://github.com/pypa/packaging/issues/171>`__)

* Use ``sys.implementation.name`` where appropriate for ``packaging.tags`` (`#193 <https://github.com/pypa/packaging/issues/193>`__)

* Expand upon the API provded by ``packaging.tags``: ``interpreter_name()``, ``mac_platforms()``, ``compatible_tags()``, ``cpython_tags()``, ``generic_tags()`` (`#187 <https://github.com/pypa/packaging/issues/187>`__)

* Officially support Python 3.8 (`#232 <https://github.com/pypa/packaging/issues/232>`__)

* Add ``major``, ``minor``, and ``micro`` aliases to ``packaging.version.Version`` (`#226 <https://github.com/pypa/packaging/issues/226>`__)

* Properly mark ``packaging`` has being fully typed by adding a `py.typed` file (`#226 <https://github.com/pypa/packaging/issues/226>`__)

19.2 - 2019-09-18
~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.33.6)
Generator: bdist_wheel (0.34.2)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any
Expand Down
4 changes: 2 additions & 2 deletions pex/vendor/_vendored/packaging/packaging/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "19.2"
__version__ = "20.4"

__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"

__license__ = "BSD or Apache License, Version 2.0"
__license__ = "BSD-2-Clause or Apache-2.0"
__copyright__ = "Copyright 2014-2019 %s" % __author__
9 changes: 8 additions & 1 deletion pex/vendor/_vendored/packaging/packaging/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

import sys

from ._typing import TYPE_CHECKING

if TYPE_CHECKING: # pragma: no cover
from typing import Any, Dict, Tuple, Type


PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
Expand All @@ -18,14 +23,16 @@


def with_metaclass(meta, *bases):
# type: (Type[Any], Tuple[Type[Any], ...]) -> Any
"""
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):
class metaclass(meta): # type: ignore
def __new__(cls, name, this_bases, d):
# type: (Type[Any], str, Tuple[Any], Dict[Any, Any]) -> Any
return meta(name, bases, d)

return type.__new__(metaclass, "temporary_class", (), {})
26 changes: 22 additions & 4 deletions pex/vendor/_vendored/packaging/packaging/_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,83 @@
from __future__ import absolute_import, division, print_function


class Infinity(object):
class InfinityType(object):
def __repr__(self):
# type: () -> str
return "Infinity"

def __hash__(self):
# type: () -> int
return hash(repr(self))

def __lt__(self, other):
# type: (object) -> bool
return False

def __le__(self, other):
# type: (object) -> bool
return False

def __eq__(self, other):
# type: (object) -> bool
return isinstance(other, self.__class__)

def __ne__(self, other):
# type: (object) -> bool
return not isinstance(other, self.__class__)

def __gt__(self, other):
# type: (object) -> bool
return True

def __ge__(self, other):
# type: (object) -> bool
return True

def __neg__(self):
# type: (object) -> NegativeInfinityType
return NegativeInfinity


Infinity = Infinity()
Infinity = InfinityType()


class NegativeInfinity(object):
class NegativeInfinityType(object):
def __repr__(self):
# type: () -> str
return "-Infinity"

def __hash__(self):
# type: () -> int
return hash(repr(self))

def __lt__(self, other):
# type: (object) -> bool
return True

def __le__(self, other):
# type: (object) -> bool
return True

def __eq__(self, other):
# type: (object) -> bool
return isinstance(other, self.__class__)

def __ne__(self, other):
# type: (object) -> bool
return not isinstance(other, self.__class__)

def __gt__(self, other):
# type: (object) -> bool
return False

def __ge__(self, other):
# type: (object) -> bool
return False

def __neg__(self):
# type: (object) -> InfinityType
return Infinity


NegativeInfinity = NegativeInfinity()
NegativeInfinity = NegativeInfinityType()
48 changes: 48 additions & 0 deletions pex/vendor/_vendored/packaging/packaging/_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""For neatly implementing static typing in packaging.
`mypy` - the static type analysis tool we use - uses the `typing` module, which
provides core functionality fundamental to mypy's functioning.
Generally, `typing` would be imported at runtime and used in that fashion -
it acts as a no-op at runtime and does not have any run-time overhead by
design.
As it turns out, `typing` is not vendorable - it uses separate sources for
Python 2/Python 3. Thus, this codebase can not expect it to be present.
To work around this, mypy allows the typing import to be behind a False-y
optional to prevent it from running at runtime and type-comments can be used
to remove the need for the types to be accessible directly during runtime.
This module provides the False-y guard in a nicely named fashion so that a
curious maintainer can reach here to read this.
In packaging, all static-typing related imports should be guarded as follows:
from packaging._typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import ...
Ref: https://github.com/python/mypy/issues/3216
"""

__all__ = ["TYPE_CHECKING", "cast"]

# The TYPE_CHECKING constant defined by the typing module is False at runtime
# but True while type checking.
if False: # pragma: no cover
from typing import TYPE_CHECKING
else:
TYPE_CHECKING = False

# typing's cast syntax requires calling typing.cast at runtime, but we don't
# want to import typing at runtime. Here, we inform the type checkers that
# we're importing `typing.cast` as `cast` and re-implement typing.cast's
# runtime behavior in a block that is ignored by type checkers.
if TYPE_CHECKING: # pragma: no cover
# not executed at runtime
from typing import cast
else:
# executed at runtime
def cast(type_, value): # noqa
return value
Loading

0 comments on commit 8460d6e

Please sign in to comment.