aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-12-05 12:30:19 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-12-05 13:51:30 +0300
commite69e63ed814792594791cf49bb976c9338bab02f (patch)
tree5f899ad00cf1dde0328d53411331cd3a9701882b
parent98d84fe1fc9b4565c05cf5c191a5ee66c6f11a1a (diff)
downloadydb-e69e63ed814792594791cf49bb976c9338bab02f.tar.gz
Update contrib/python/setuptools/py3 to 69.0.0
-rw-r--r--contrib/python/setuptools/py3/.dist-info/METADATA4
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/__init__.py15
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/importlib_resources/py.typed0
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/py.typed0
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/packaging/py.typed0
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/platformdirs/py.typed0
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/_functools.py53
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/_modified.py72
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/bcppcompiler.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/ccompiler.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/cmd.py4
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/command/build_ext.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/command/build_scripts.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/dep_util.py104
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/file_util.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/py39compat.py46
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/unixccompiler.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_distutils/util.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_normalization.py43
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/importlib_metadata/py.typed0
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/importlib_resources/py.typed0
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/py.typed0
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/packaging/py.typed0
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/tomli/py.typed1
-rw-r--r--contrib/python/setuptools/py3/setuptools/build_meta.py43
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/build_clib.py7
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/build_py.py10
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/develop.py3
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/dist_info.py16
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/easy_install.py10
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/egg_info.py7
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/sdist.py3
-rw-r--r--contrib/python/setuptools/py3/setuptools/command/upload_docs.py3
-rw-r--r--contrib/python/setuptools/py3/setuptools/config/_apply_pyprojecttoml.py76
-rw-r--r--contrib/python/setuptools/py3/setuptools/config/expand.py3
-rw-r--r--contrib/python/setuptools/py3/setuptools/config/pyprojecttoml.py10
-rw-r--r--contrib/python/setuptools/py3/setuptools/config/setupcfg.py14
-rw-r--r--contrib/python/setuptools/py3/setuptools/dep_util.py32
-rw-r--r--contrib/python/setuptools/py3/setuptools/depends.py6
-rw-r--r--contrib/python/setuptools/py3/setuptools/dist.py44
-rw-r--r--contrib/python/setuptools/py3/setuptools/errors.py8
-rw-r--r--contrib/python/setuptools/py3/setuptools/modified.py8
-rw-r--r--contrib/python/setuptools/py3/setuptools/monkey.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/msvc.py14
-rw-r--r--contrib/python/setuptools/py3/setuptools/package_index.py2
-rw-r--r--contrib/python/setuptools/py3/setuptools/windows_support.py2
-rw-r--r--contrib/python/setuptools/py3/ya.make19
47 files changed, 378 insertions, 320 deletions
diff --git a/contrib/python/setuptools/py3/.dist-info/METADATA b/contrib/python/setuptools/py3/.dist-info/METADATA
index b462c9365c..042bd6651c 100644
--- a/contrib/python/setuptools/py3/.dist-info/METADATA
+++ b/contrib/python/setuptools/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: setuptools
-Version: 68.2.2
+Version: 69.0.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
@@ -22,6 +22,7 @@ License-File: LICENSE
Provides-Extra: certs
Provides-Extra: docs
Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
Requires-Dist: furo ; extra == 'docs'
@@ -33,7 +34,6 @@ Requires-Dist: sphinx-inline-tabs ; extra == 'docs'
Requires-Dist: sphinx-reredirects ; extra == 'docs'
Requires-Dist: sphinxcontrib-towncrier ; extra == 'docs'
Requires-Dist: sphinx-notfound-page <2,>=1 ; extra == 'docs'
-Requires-Dist: sphinx-hoverxref <2 ; extra == 'docs'
Provides-Extra: ssl
Provides-Extra: testing
Requires-Dist: pytest >=6 ; extra == 'testing'
diff --git a/contrib/python/setuptools/py3/pkg_resources/__init__.py b/contrib/python/setuptools/py3/pkg_resources/__init__.py
index 5887a520cb..283b90fda1 100644
--- a/contrib/python/setuptools/py3/pkg_resources/__init__.py
+++ b/contrib/python/setuptools/py3/pkg_resources/__init__.py
@@ -1874,7 +1874,7 @@ class ZipProvider(EggProvider):
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
if not WRITE_SUPPORT:
- raise IOError(
+ raise OSError(
'"os.rename" and "os.unlink" are not supported ' 'on this platform'
)
try:
@@ -2001,7 +2001,7 @@ class FileMetadata(EmptyProvider):
if name != 'PKG-INFO':
raise KeyError("No metadata except PKG-INFO is available")
- with io.open(self.path, encoding='utf-8', errors="replace") as f:
+ with open(self.path, encoding='utf-8', errors="replace") as f:
metadata = f.read()
self._warn_on_replacement(metadata)
return metadata
@@ -2095,8 +2095,7 @@ def find_eggs_in_zip(importer, path_item, only=False):
if _is_egg_path(subitem):
subpath = os.path.join(path_item, subitem)
dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
- for dist in dists:
- yield dist
+ yield from dists
elif subitem.lower().endswith(('.dist-info', '.egg-info')):
subpath = os.path.join(path_item, subitem)
submeta = EggMetadata(zipimport.zipimporter(subpath))
@@ -2131,8 +2130,7 @@ def find_on_path(importer, path_item, only=False):
for entry in sorted(entries):
fullpath = os.path.join(path_item, entry)
factory = dist_factory(path_item, entry, only)
- for dist in factory(fullpath):
- yield dist
+ yield from factory(fullpath)
def dist_factory(path_item, entry, only):
@@ -2850,8 +2848,7 @@ class Distribution:
def _get_metadata(self, name):
if self.has_metadata(name):
- for line in self.get_metadata_lines(name):
- yield line
+ yield from self.get_metadata_lines(name)
def _get_version(self):
lines = self._get_metadata(self.PKG_INFO)
@@ -3243,7 +3240,7 @@ def ensure_directory(path):
def _bypass_ensure_directory(path):
"""Sandbox-bypassing version of ensure_directory()"""
if not WRITE_SUPPORT:
- raise IOError('"os.mkdir" not supported on this platform.')
+ raise OSError('"os.mkdir" not supported on this platform.')
dirname, filename = split(path)
if dirname and filename and not isdir(dirname):
_bypass_ensure_directory(dirname)
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/importlib_resources/py.typed b/contrib/python/setuptools/py3/pkg_resources/_vendor/importlib_resources/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/importlib_resources/py.typed
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/py.typed b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/py.typed
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/packaging/py.typed b/contrib/python/setuptools/py3/pkg_resources/_vendor/packaging/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/packaging/py.typed
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/platformdirs/py.typed b/contrib/python/setuptools/py3/pkg_resources/_vendor/platformdirs/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/platformdirs/py.typed
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/_functools.py b/contrib/python/setuptools/py3/setuptools/_distutils/_functools.py
index e7053bac12..e03365eafa 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/_functools.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/_functools.py
@@ -1,3 +1,4 @@
+import collections.abc
import functools
@@ -18,3 +19,55 @@ def pass_none(func):
return func(param, *args, **kwargs)
return wrapper
+
+
+# from jaraco.functools 4.0
+@functools.singledispatch
+def _splat_inner(args, func):
+ """Splat args to func."""
+ return func(*args)
+
+
+@_splat_inner.register
+def _(args: collections.abc.Mapping, func):
+ """Splat kargs to func as kwargs."""
+ return func(**args)
+
+
+def splat(func):
+ """
+ Wrap func to expect its parameters to be passed positionally in a tuple.
+
+ Has a similar effect to that of ``itertools.starmap`` over
+ simple ``map``.
+
+ >>> import itertools, operator
+ >>> pairs = [(-1, 1), (0, 2)]
+ >>> _ = tuple(itertools.starmap(print, pairs))
+ -1 1
+ 0 2
+ >>> _ = tuple(map(splat(print), pairs))
+ -1 1
+ 0 2
+
+ The approach generalizes to other iterators that don't have a "star"
+ equivalent, such as a "starfilter".
+
+ >>> list(filter(splat(operator.add), pairs))
+ [(0, 2)]
+
+ Splat also accepts a mapping argument.
+
+ >>> def is_nice(msg, code):
+ ... return "smile" in msg or code == 0
+ >>> msgs = [
+ ... dict(msg='smile!', code=20),
+ ... dict(msg='error :(', code=1),
+ ... dict(msg='unknown', code=0),
+ ... ]
+ >>> for msg in filter(splat(is_nice), msgs):
+ ... print(msg)
+ {'msg': 'smile!', 'code': 20}
+ {'msg': 'unknown', 'code': 0}
+ """
+ return functools.wraps(func)(functools.partial(_splat_inner, func=func))
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/_modified.py b/contrib/python/setuptools/py3/setuptools/_distutils/_modified.py
new file mode 100644
index 0000000000..fbb95a8f27
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/_modified.py
@@ -0,0 +1,72 @@
+"""Timestamp comparison of files and groups of files."""
+
+import functools
+import os.path
+
+from .errors import DistutilsFileError
+from .py39compat import zip_strict
+from ._functools import splat
+
+
+def _newer(source, target):
+ return not os.path.exists(target) or (
+ os.path.getmtime(source) > os.path.getmtime(target)
+ )
+
+
+def newer(source, target):
+ """
+ Is source modified more recently than target.
+
+ Returns True if 'source' is modified more recently than
+ 'target' or if 'target' does not exist.
+
+ Raises DistutilsFileError if 'source' does not exist.
+ """
+ if not os.path.exists(source):
+ raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source))
+
+ return _newer(source, target)
+
+
+def newer_pairwise(sources, targets, newer=newer):
+ """
+ Filter filenames where sources are newer than targets.
+
+ Walk two filename iterables in parallel, testing if each source is newer
+ than its corresponding target. Returns a pair of lists (sources,
+ targets) where source is newer than target, according to the semantics
+ of 'newer()'.
+ """
+ newer_pairs = filter(splat(newer), zip_strict(sources, targets))
+ return tuple(map(list, zip(*newer_pairs))) or ([], [])
+
+
+def newer_group(sources, target, missing='error'):
+ """
+ Is target out-of-date with respect to any file in sources.
+
+ Return True if 'target' is out-of-date with respect to any file
+ listed in 'sources'. In other words, if 'target' exists and is newer
+ than every file in 'sources', return False; otherwise return True.
+ ``missing`` controls how to handle a missing source file:
+
+ - error (default): allow the ``stat()`` call to fail.
+ - ignore: silently disregard any missing source files.
+ - newer: treat missing source files as "target out of date". This
+ mode is handy in "dry-run" mode: it will pretend to carry out
+ commands that wouldn't work because inputs are missing, but
+ that doesn't matter because dry-run won't run the commands.
+ """
+
+ def missing_as_newer(source):
+ return missing == 'newer' and not os.path.exists(source)
+
+ ignored = os.path.exists if missing == 'ignore' else None
+ return any(
+ missing_as_newer(source) or _newer(source, target)
+ for source in filter(ignored, sources)
+ )
+
+
+newer_pairwise_group = functools.partial(newer_pairwise, newer=newer_group)
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/bcppcompiler.py b/contrib/python/setuptools/py3/setuptools/_distutils/bcppcompiler.py
index ba45ea2b95..3c2ba15410 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/bcppcompiler.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/bcppcompiler.py
@@ -24,7 +24,7 @@ from .errors import (
)
from .ccompiler import CCompiler, gen_preprocess_options
from .file_util import write_file
-from .dep_util import newer
+from ._modified import newer
from ._log import log
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/ccompiler.py b/contrib/python/setuptools/py3/setuptools/_distutils/ccompiler.py
index 1818fce901..c1c7d5476e 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/ccompiler.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/ccompiler.py
@@ -18,7 +18,7 @@ from .errors import (
from .spawn import spawn
from .file_util import move_file
from .dir_util import mkpath
-from .dep_util import newer_group
+from ._modified import newer_group
from .util import split_quoted, execute
from ._log import log
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/cmd.py b/contrib/python/setuptools/py3/setuptools/_distutils/cmd.py
index 3860c3ff1e..8fdcbc0ea2 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/cmd.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/cmd.py
@@ -10,7 +10,7 @@ import re
import logging
from .errors import DistutilsOptionError
-from . import util, dir_util, file_util, archive_util, dep_util
+from . import util, dir_util, file_util, archive_util, _modified
from ._log import log
@@ -428,7 +428,7 @@ class Command:
# If 'outfile' must be regenerated (either because it doesn't
# exist, is out-of-date, or the 'force' flag is true) then
# perform the action that presumably regenerates it
- if self.force or dep_util.newer_group(infiles, outfile):
+ if self.force or _modified.newer_group(infiles, outfile):
self.execute(func, args, exec_msg, level)
# Otherwise, print the "skip" message
else:
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/command/build_ext.py b/contrib/python/setuptools/py3/setuptools/_distutils/command/build_ext.py
index fbeec342c0..b48f462626 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/command/build_ext.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/command/build_ext.py
@@ -19,7 +19,7 @@ from ..errors import (
)
from ..sysconfig import customize_compiler, get_python_version
from ..sysconfig import get_config_h_filename
-from ..dep_util import newer_group
+from .._modified import newer_group
from ..extension import Extension
from ..util import get_platform
from distutils._log import log
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/command/build_scripts.py b/contrib/python/setuptools/py3/setuptools/_distutils/command/build_scripts.py
index ce222f1e52..1a4d67f492 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/command/build_scripts.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/command/build_scripts.py
@@ -7,7 +7,7 @@ import re
from stat import ST_MODE
from distutils import sysconfig
from ..core import Command
-from ..dep_util import newer
+from .._modified import newer
from ..util import convert_path
from distutils._log import log
import tokenize
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/dep_util.py b/contrib/python/setuptools/py3/setuptools/_distutils/dep_util.py
index 48da8641c6..09a8a2e126 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/dep_util.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/dep_util.py
@@ -1,96 +1,14 @@
-"""distutils.dep_util
+import warnings
-Utility functions for simple, timestamp-based dependency of files
-and groups of files; also, function based entirely on such
-timestamp dependency analysis."""
+from . import _modified
-import os
-from .errors import DistutilsFileError
-
-def newer(source, target):
- """Return true if 'source' exists and is more recently modified than
- 'target', or if 'source' exists and 'target' doesn't. Return false if
- both exist and 'target' is the same age or younger than 'source'.
- Raise DistutilsFileError if 'source' does not exist.
- """
- if not os.path.exists(source):
- raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source))
- if not os.path.exists(target):
- return 1
-
- from stat import ST_MTIME
-
- mtime1 = os.stat(source)[ST_MTIME]
- mtime2 = os.stat(target)[ST_MTIME]
-
- return mtime1 > mtime2
-
-
-# newer ()
-
-
-def newer_pairwise(sources, targets):
- """Walk two filename lists in parallel, testing if each source is newer
- than its corresponding target. Return a pair of lists (sources,
- targets) where source is newer than target, according to the semantics
- of 'newer()'.
- """
- if len(sources) != len(targets):
- raise ValueError("'sources' and 'targets' must be same length")
-
- # build a pair of lists (sources, targets) where source is newer
- n_sources = []
- n_targets = []
- for i in range(len(sources)):
- if newer(sources[i], targets[i]):
- n_sources.append(sources[i])
- n_targets.append(targets[i])
-
- return (n_sources, n_targets)
-
-
-# newer_pairwise ()
-
-
-def newer_group(sources, target, missing='error'):
- """Return true if 'target' is out-of-date with respect to any file
- listed in 'sources'. In other words, if 'target' exists and is newer
- than every file in 'sources', return false; otherwise return true.
- 'missing' controls what we do when a source file is missing; the
- default ("error") is to blow up with an OSError from inside 'stat()';
- if it is "ignore", we silently drop any missing source files; if it is
- "newer", any missing source files make us assume that 'target' is
- out-of-date (this is handy in "dry-run" mode: it'll make you pretend to
- carry out commands that wouldn't work because inputs are missing, but
- that doesn't matter because you're not actually going to run the
- commands).
- """
- # If the target doesn't even exist, then it's definitely out-of-date.
- if not os.path.exists(target):
- return 1
-
- # Otherwise we have to find out the hard way: if *any* source file
- # is more recent than 'target', then 'target' is out-of-date and
- # we can immediately return true. If we fall through to the end
- # of the loop, then 'target' is up-to-date and we return false.
- from stat import ST_MTIME
-
- target_mtime = os.stat(target)[ST_MTIME]
- for source in sources:
- if not os.path.exists(source):
- if missing == 'error': # blow up when we stat() the file
- pass
- elif missing == 'ignore': # missing source dropped from
- continue # target's dependency list
- elif missing == 'newer': # missing source means target is
- return 1 # out-of-date
-
- source_mtime = os.stat(source)[ST_MTIME]
- if source_mtime > target_mtime:
- return 1
- else:
- return 0
-
-
-# newer_group ()
+def __getattr__(name):
+ if name not in ['newer', 'newer_group', 'newer_pairwise']:
+ raise AttributeError(name)
+ warnings.warn(
+ "dep_util is Deprecated. Use functions from setuptools instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ return getattr(_modified, name)
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/file_util.py b/contrib/python/setuptools/py3/setuptools/_distutils/file_util.py
index 7c69906646..3f3e21b567 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/file_util.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/file_util.py
@@ -108,7 +108,7 @@ def copy_file( # noqa: C901
# changing it (ie. it's not already a hard/soft link to src OR
# (not update) and (src newer than dst).
- from distutils.dep_util import newer
+ from distutils._modified import newer
from stat import ST_ATIME, ST_MTIME, ST_MODE, S_IMODE
if not os.path.isfile(src):
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/py39compat.py b/contrib/python/setuptools/py3/setuptools/_distutils/py39compat.py
index c43e5f10fd..1b436d7658 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/py39compat.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/py39compat.py
@@ -1,5 +1,7 @@
-import sys
+import functools
+import itertools
import platform
+import sys
def add_ext_suffix_39(vars):
@@ -20,3 +22,45 @@ def add_ext_suffix_39(vars):
needs_ext_suffix = sys.version_info < (3, 10) and platform.system() == 'Windows'
add_ext_suffix = add_ext_suffix_39 if needs_ext_suffix else lambda vars: None
+
+
+# from more_itertools
+class UnequalIterablesError(ValueError):
+ def __init__(self, details=None):
+ msg = 'Iterables have different lengths'
+ if details is not None:
+ msg += (': index 0 has length {}; index {} has length {}').format(*details)
+
+ super().__init__(msg)
+
+
+# from more_itertools
+def _zip_equal_generator(iterables):
+ _marker = object()
+ for combo in itertools.zip_longest(*iterables, fillvalue=_marker):
+ for val in combo:
+ if val is _marker:
+ raise UnequalIterablesError()
+ yield combo
+
+
+# from more_itertools
+def _zip_equal(*iterables):
+ # Check whether the iterables are all the same size.
+ try:
+ first_size = len(iterables[0])
+ for i, it in enumerate(iterables[1:], 1):
+ size = len(it)
+ if size != first_size:
+ raise UnequalIterablesError(details=(first_size, i, size))
+ # All sizes are equal, we can use the built-in zip.
+ return zip(*iterables)
+ # If any one of the iterables didn't have a length, start reading
+ # them until one runs out.
+ except TypeError:
+ return _zip_equal_generator(iterables)
+
+
+zip_strict = (
+ _zip_equal if sys.version_info < (3, 10) else functools.partial(zip, strict=True)
+)
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/unixccompiler.py b/contrib/python/setuptools/py3/setuptools/_distutils/unixccompiler.py
index 6ca2332ae1..bd8db9ac3f 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/unixccompiler.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/unixccompiler.py
@@ -20,7 +20,7 @@ import shlex
import itertools
from . import sysconfig
-from .dep_util import newer
+from ._modified import newer
from .ccompiler import CCompiler, gen_preprocess_options, gen_lib_options
from .errors import DistutilsExecError, CompileError, LibError, LinkError
from ._log import log
diff --git a/contrib/python/setuptools/py3/setuptools/_distutils/util.py b/contrib/python/setuptools/py3/setuptools/_distutils/util.py
index 7ef47176e2..7ae914f7ee 100644
--- a/contrib/python/setuptools/py3/setuptools/_distutils/util.py
+++ b/contrib/python/setuptools/py3/setuptools/_distutils/util.py
@@ -14,7 +14,7 @@ import sysconfig
import functools
from .errors import DistutilsPlatformError, DistutilsByteCompileError
-from .dep_util import newer
+from ._modified import newer
from .spawn import spawn
from ._log import log
diff --git a/contrib/python/setuptools/py3/setuptools/_normalization.py b/contrib/python/setuptools/py3/setuptools/_normalization.py
index 3e94e662ef..eee4fb7746 100644
--- a/contrib/python/setuptools/py3/setuptools/_normalization.py
+++ b/contrib/python/setuptools/py3/setuptools/_normalization.py
@@ -7,7 +7,6 @@ from pathlib import Path
from typing import Union
from .extern import packaging
-from .warnings import SetuptoolsDeprecationWarning
_Path = Union[str, Path]
@@ -15,6 +14,7 @@ _Path = Union[str, Path]
_VALID_NAME = re.compile(r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.I)
_UNSAFE_NAME_CHARS = re.compile(r"[^A-Z0-9.]+", re.I)
_NON_ALPHANUMERIC = re.compile(r"[^A-Z0-9]+", re.I)
+_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
def safe_identifier(name: str) -> str:
@@ -42,6 +42,8 @@ def safe_name(component: str) -> str:
def safe_version(version: str) -> str:
"""Convert an arbitrary string into a valid version string.
+ Can still raise an ``InvalidVersion`` exception.
+ To avoid exceptions use ``best_effort_version``.
>>> safe_version("1988 12 25")
'1988.12.25'
>>> safe_version("v0.2.1")
@@ -65,32 +67,35 @@ def safe_version(version: str) -> str:
def best_effort_version(version: str) -> str:
"""Convert an arbitrary string into a version-like string.
+ Fallback when ``safe_version`` is not safe enough.
>>> best_effort_version("v0.2 beta")
'0.2b0'
-
- >>> import warnings
- >>> warnings.simplefilter("ignore", category=SetuptoolsDeprecationWarning)
>>> best_effort_version("ubuntu lts")
- 'ubuntu.lts'
+ '0.dev0+sanitized.ubuntu.lts'
+ >>> best_effort_version("0.23ubuntu1")
+ '0.23.dev0+sanitized.ubuntu1'
+ >>> best_effort_version("0.23-")
+ '0.23.dev0+sanitized'
+ >>> best_effort_version("0.-_")
+ '0.dev0+sanitized'
+ >>> best_effort_version("42.+?1")
+ '42.dev0+sanitized.1'
"""
- # See pkg_resources.safe_version
+ # See pkg_resources._forgiving_version
try:
return safe_version(version)
except packaging.version.InvalidVersion:
- SetuptoolsDeprecationWarning.emit(
- f"Invalid version: {version!r}.",
- f"""
- Version {version!r} is not valid according to PEP 440.
-
- Please make sure to specify a valid version for your package.
- Also note that future releases of setuptools may halt the build process
- if an invalid version is given.
- """,
- see_url="https://peps.python.org/pep-0440/",
- due_date=(2023, 9, 26), # See setuptools/dist _validate_version
- )
v = version.replace(' ', '.')
- return safe_name(v)
+ match = _PEP440_FALLBACK.search(v)
+ if match:
+ safe = match["safe"]
+ rest = v[len(safe) :]
+ else:
+ safe = "0"
+ rest = version
+ safe_rest = _NON_ALPHANUMERIC.sub(".", rest).strip(".")
+ local = f"sanitized.{safe_rest}".strip(".")
+ return safe_version(f"{safe}.dev0+{local}")
def safe_extra(extra: str) -> str:
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/importlib_metadata/py.typed b/contrib/python/setuptools/py3/setuptools/_vendor/importlib_metadata/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/importlib_metadata/py.typed
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/importlib_resources/py.typed b/contrib/python/setuptools/py3/setuptools/_vendor/importlib_resources/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/importlib_resources/py.typed
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/py.typed b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/py.typed
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/packaging/py.typed b/contrib/python/setuptools/py3/setuptools/_vendor/packaging/py.typed
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/packaging/py.typed
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/tomli/py.typed b/contrib/python/setuptools/py3/setuptools/_vendor/tomli/py.typed
new file mode 100644
index 0000000000..7632ecf775
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/tomli/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561
diff --git a/contrib/python/setuptools/py3/setuptools/build_meta.py b/contrib/python/setuptools/py3/setuptools/build_meta.py
index 9267cf312f..6da80d70b8 100644
--- a/contrib/python/setuptools/py3/setuptools/build_meta.py
+++ b/contrib/python/setuptools/py3/setuptools/build_meta.py
@@ -185,11 +185,6 @@ class _ConfigSettingsTranslator:
opts = cfg.get(key) or []
return shlex.split(opts) if isinstance(opts, str) else opts
- def _valid_global_options(self):
- """Global options accepted by setuptools (e.g. quiet or verbose)."""
- options = (opt[:2] for opt in setuptools.dist.Distribution.global_options)
- return {flag for long_and_short in options for flag in long_and_short if flag}
-
def _global_args(self, config_settings: _ConfigSettings) -> Iterator[str]:
"""
Let the user specify ``verbose`` or ``quiet`` + escape hatch via
@@ -220,9 +215,7 @@ class _ConfigSettingsTranslator:
level = str(cfg.get("quiet") or cfg.get("--quiet") or "1")
yield ("-v" if level.lower() in falsey else "-q")
- valid = self._valid_global_options()
- args = self._get_config("--global-option", config_settings)
- yield from (arg for arg in args if arg.strip("-") in valid)
+ yield from self._get_config("--global-option", config_settings)
def __dist_info_args(self, config_settings: _ConfigSettings) -> Iterator[str]:
"""
@@ -284,33 +277,11 @@ class _ConfigSettingsTranslator:
['foo']
>>> list(fn({'--build-option': 'foo bar'}))
['foo', 'bar']
- >>> warnings.simplefilter('error', SetuptoolsDeprecationWarning)
- >>> list(fn({'--global-option': 'foo'})) # doctest: +IGNORE_EXCEPTION_DETAIL
- Traceback (most recent call last):
- SetuptoolsDeprecationWarning: ...arguments given via `--global-option`...
+ >>> list(fn({'--global-option': 'foo'}))
+ []
"""
- args = self._get_config("--global-option", config_settings)
- global_opts = self._valid_global_options()
- bad_args = []
-
- for arg in args:
- if arg.strip("-") not in global_opts:
- bad_args.append(arg)
- yield arg
-
yield from self._get_config("--build-option", config_settings)
- if bad_args:
- SetuptoolsDeprecationWarning.emit(
- "Incompatible `config_settings` passed to build backend.",
- f"""
- The arguments {bad_args!r} were given via `--global-option`.
- Please use `--build-option` instead,
- `--global-option` is reserved for flags like `--verbose` or `--quiet`.
- """,
- due_date=(2023, 9, 26), # Warning introduced in v64.0.1, 11/Aug/2022.
- )
-
class _BuildMetaBackend(_ConfigSettingsTranslator):
def _get_build_requires(self, config_settings, requirements):
@@ -318,7 +289,6 @@ class _BuildMetaBackend(_ConfigSettingsTranslator):
*sys.argv[:1],
*self._global_args(config_settings),
"egg_info",
- *self._arbitrary_args(config_settings),
]
try:
with Distribution.patch():
@@ -406,6 +376,7 @@ class _BuildMetaBackend(_ConfigSettingsTranslator):
# Build in a temporary directory, then copy to the target.
os.makedirs(result_directory, exist_ok=True)
temp_opts = {"prefix": ".tmp-", "dir": result_directory}
+
with tempfile.TemporaryDirectory(**temp_opts) as tmp_dist_dir:
sys.argv = [
*sys.argv[:1],
@@ -413,7 +384,6 @@ class _BuildMetaBackend(_ConfigSettingsTranslator):
*setup_command,
"--dist-dir",
tmp_dist_dir,
- *self._arbitrary_args(config_settings),
]
with no_install_setup_requires():
self.run_setup()
@@ -432,7 +402,10 @@ class _BuildMetaBackend(_ConfigSettingsTranslator):
):
with suppress_known_deprecation():
return self._build_with_temp_dir(
- ['bdist_wheel'], '.whl', wheel_directory, config_settings
+ ['bdist_wheel', *self._arbitrary_args(config_settings)],
+ '.whl',
+ wheel_directory,
+ config_settings,
)
def build_sdist(self, sdist_directory, config_settings=None):
diff --git a/contrib/python/setuptools/py3/setuptools/command/build_clib.py b/contrib/python/setuptools/py3/setuptools/command/build_clib.py
index 5f4229b276..acd4d1d3ba 100644
--- a/contrib/python/setuptools/py3/setuptools/command/build_clib.py
+++ b/contrib/python/setuptools/py3/setuptools/command/build_clib.py
@@ -1,7 +1,12 @@
import distutils.command.build_clib as orig
from distutils.errors import DistutilsSetupError
from distutils import log
-from setuptools.dep_util import newer_pairwise_group
+
+try:
+ from distutils._modified import newer_pairwise_group
+except ImportError:
+ # fallback for SETUPTOOLS_USE_DISTUTILS=stdlib
+ from .._distutils._modified import newer_pairwise_group
class build_clib(orig.build_clib):
diff --git a/contrib/python/setuptools/py3/setuptools/command/build_py.py b/contrib/python/setuptools/py3/setuptools/command/build_py.py
index 5709eb6d8c..cbdd05aab0 100644
--- a/contrib/python/setuptools/py3/setuptools/command/build_py.py
+++ b/contrib/python/setuptools/py3/setuptools/command/build_py.py
@@ -5,7 +5,6 @@ import distutils.command.build_py as orig
import os
import fnmatch
import textwrap
-import io
import distutils.errors
import itertools
import stat
@@ -16,6 +15,9 @@ from ..extern.more_itertools import unique_everseen
from ..warnings import SetuptoolsDeprecationWarning
+_IMPLICIT_DATA_FILES = ('*.pyi', 'py.typed')
+
+
def make_writable(target):
os.chmod(target, os.stat(target).st_mode | stat.S_IWRITE)
@@ -116,6 +118,7 @@ class build_py(orig.build_py):
self.package_data,
package,
src_dir,
+ extra_patterns=_IMPLICIT_DATA_FILES,
)
globs_expanded = map(partial(glob, recursive=True), patterns)
# flatten the expanded globs into an iterable of matches
@@ -245,7 +248,7 @@ class build_py(orig.build_py):
else:
return init_py
- with io.open(init_py, 'rb') as f:
+ with open(init_py, 'rb') as f:
contents = f.read()
if b'declare_namespace' not in contents:
raise distutils.errors.DistutilsError(
@@ -285,7 +288,7 @@ class build_py(orig.build_py):
return list(unique_everseen(keepers))
@staticmethod
- def _get_platform_patterns(spec, package, src_dir):
+ def _get_platform_patterns(spec, package, src_dir, extra_patterns=[]):
"""
yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
@@ -293,6 +296,7 @@ class build_py(orig.build_py):
matching package in src_dir.
"""
raw_patterns = itertools.chain(
+ extra_patterns,
spec.get('', []),
spec.get(package, []),
)
diff --git a/contrib/python/setuptools/py3/setuptools/command/develop.py b/contrib/python/setuptools/py3/setuptools/command/develop.py
index 27bcf9eb5b..ea3e48e55c 100644
--- a/contrib/python/setuptools/py3/setuptools/command/develop.py
+++ b/contrib/python/setuptools/py3/setuptools/command/develop.py
@@ -3,7 +3,6 @@ from distutils import log
from distutils.errors import DistutilsOptionError
import os
import glob
-import io
from setuptools.command.easy_install import easy_install
from setuptools import _path
@@ -154,7 +153,7 @@ class develop(namespaces.DevelopInstaller, easy_install):
for script_name in self.distribution.scripts or []:
script_path = os.path.abspath(convert_path(script_name))
script_name = os.path.basename(script_path)
- with io.open(script_path) as strm:
+ with open(script_path) as strm:
script_text = strm.read()
self.install_script(dist, script_name, script_text, script_path)
diff --git a/contrib/python/setuptools/py3/setuptools/command/dist_info.py b/contrib/python/setuptools/py3/setuptools/command/dist_info.py
index 9df625cee7..5ef322168c 100644
--- a/contrib/python/setuptools/py3/setuptools/command/dist_info.py
+++ b/contrib/python/setuptools/py3/setuptools/command/dist_info.py
@@ -12,7 +12,6 @@ from distutils.core import Command
from pathlib import Path
from .. import _normalization
-from ..warnings import SetuptoolsDeprecationWarning
class dist_info(Command):
@@ -25,13 +24,6 @@ class dist_info(Command):
user_options = [
(
- 'egg-base=',
- 'e',
- "directory containing .egg-info directories"
- " (default: top of the source tree)"
- " DEPRECATED: use --output-dir.",
- ),
- (
'output-dir=',
'o',
"directory inside of which the .dist-info will be"
@@ -47,7 +39,6 @@ class dist_info(Command):
negative_opt = {'no-date': 'tag-date'}
def initialize_options(self):
- self.egg_base = None
self.output_dir = None
self.name = None
self.dist_info_dir = None
@@ -56,13 +47,6 @@ class dist_info(Command):
self.keep_egg_info = False
def finalize_options(self):
- if self.egg_base:
- msg = "--egg-base is deprecated for dist_info command. Use --output-dir."
- SetuptoolsDeprecationWarning.emit(msg, due_date=(2023, 9, 26))
- # This command is internal to setuptools, therefore it should be safe
- # to remove the deprecated support soon.
- self.output_dir = self.egg_base or self.output_dir
-
dist = self.distribution
project_dir = dist.src_root or os.curdir
self.output_dir = Path(self.output_dir or project_dir)
diff --git a/contrib/python/setuptools/py3/setuptools/command/easy_install.py b/contrib/python/setuptools/py3/setuptools/command/easy_install.py
index 8ba4f094de..5d6fd5ca71 100644
--- a/contrib/python/setuptools/py3/setuptools/command/easy_install.py
+++ b/contrib/python/setuptools/py3/setuptools/command/easy_install.py
@@ -480,7 +480,7 @@ class easy_install(Command):
if not os.path.exists(instdir):
try:
os.makedirs(instdir)
- except (OSError, IOError):
+ except OSError:
self.cant_write_to_target()
# Is it a configured, PYTHONPATH, implicit, or explicit site dir?
@@ -498,7 +498,7 @@ class easy_install(Command):
os.unlink(testfile)
open(testfile, 'w').close()
os.unlink(testfile)
- except (OSError, IOError):
+ except OSError:
self.cant_write_to_target()
if not is_site_dir and not self.multi_version:
@@ -594,7 +594,7 @@ class easy_install(Command):
dirname = os.path.dirname(ok_file)
os.makedirs(dirname, exist_ok=True)
f = open(pth_file, 'w')
- except (OSError, IOError):
+ except OSError:
self.cant_write_to_target()
else:
try:
@@ -1995,9 +1995,9 @@ def is_python(text, filename='<string>'):
def is_sh(executable):
"""Determine if the specified executable is a .sh (contains a #! line)"""
try:
- with io.open(executable, encoding='latin-1') as fp:
+ with open(executable, encoding='latin-1') as fp:
magic = fp.read(2)
- except (OSError, IOError):
+ except OSError:
return executable
return magic == '#!'
diff --git a/contrib/python/setuptools/py3/setuptools/command/egg_info.py b/contrib/python/setuptools/py3/setuptools/command/egg_info.py
index a5199deb33..7c7f57aaf8 100644
--- a/contrib/python/setuptools/py3/setuptools/command/egg_info.py
+++ b/contrib/python/setuptools/py3/setuptools/command/egg_info.py
@@ -127,7 +127,7 @@ class InfoCommon:
def tagged_version(self):
tagged = self._maybe_tag(self.distribution.get_version())
- return _normalization.best_effort_version(tagged)
+ return _normalization.safe_version(tagged)
def _maybe_tag(self, version):
"""
@@ -148,7 +148,10 @@ class InfoCommon:
def _safe_tags(self) -> str:
# To implement this we can rely on `safe_version` pretending to be version 0
# followed by tags. Then we simply discard the starting 0 (fake version number)
- return _normalization.best_effort_version(f"0{self.vtags}")[1:]
+ try:
+ return _normalization.safe_version(f"0{self.vtags}")[1:]
+ except packaging.version.InvalidVersion:
+ return _normalization.safe_name(self.vtags.replace(' ', '.'))
def tags(self) -> str:
version = ''
diff --git a/contrib/python/setuptools/py3/setuptools/command/sdist.py b/contrib/python/setuptools/py3/setuptools/command/sdist.py
index c04823c159..5f45fb5dee 100644
--- a/contrib/python/setuptools/py3/setuptools/command/sdist.py
+++ b/contrib/python/setuptools/py3/setuptools/command/sdist.py
@@ -2,7 +2,6 @@ from distutils import log
import distutils.command.sdist as orig
import os
import sys
-import io
import contextlib
from itertools import chain
@@ -189,7 +188,7 @@ class sdist(orig.sdist):
if not os.path.isfile(self.manifest):
return False
- with io.open(self.manifest, 'rb') as fp:
+ with open(self.manifest, 'rb') as fp:
first_line = fp.readline()
return first_line != '# file GENERATED by distutils, do NOT edit\n'.encode()
diff --git a/contrib/python/setuptools/py3/setuptools/command/upload_docs.py b/contrib/python/setuptools/py3/setuptools/command/upload_docs.py
index 27c98b7c30..32c9abd796 100644
--- a/contrib/python/setuptools/py3/setuptools/command/upload_docs.py
+++ b/contrib/python/setuptools/py3/setuptools/command/upload_docs.py
@@ -8,7 +8,6 @@ from base64 import standard_b64encode
from distutils import log
from distutils.errors import DistutilsOptionError
import os
-import socket
import zipfile
import tempfile
import shutil
@@ -201,7 +200,7 @@ class upload_docs(upload):
conn.putheader('Authorization', auth)
conn.endheaders()
conn.send(body)
- except socket.error as e:
+ except OSError as e:
self.announce(str(e), log.ERROR)
return
diff --git a/contrib/python/setuptools/py3/setuptools/config/_apply_pyprojecttoml.py b/contrib/python/setuptools/py3/setuptools/config/_apply_pyprojecttoml.py
index 4489d22437..80318d5d0b 100644
--- a/contrib/python/setuptools/py3/setuptools/config/_apply_pyprojecttoml.py
+++ b/contrib/python/setuptools/py3/setuptools/config/_apply_pyprojecttoml.py
@@ -12,6 +12,7 @@ import os
from collections.abc import Mapping
from email.headerregistry import Address
from functools import partial, reduce
+from inspect import cleandoc
from itertools import chain
from types import MappingProxyType
from typing import (
@@ -28,7 +29,8 @@ from typing import (
cast,
)
-from ..warnings import SetuptoolsWarning, SetuptoolsDeprecationWarning
+from ..errors import RemovedConfigError
+from ..warnings import SetuptoolsWarning
if TYPE_CHECKING:
from setuptools._importlib import metadata # noqa
@@ -90,12 +92,13 @@ def _apply_tool_table(dist: "Distribution", config: dict, filename: _Path):
for field, value in tool_table.items():
norm_key = json_compatible_key(field)
- if norm_key in TOOL_TABLE_DEPRECATIONS:
- suggestion, kwargs = TOOL_TABLE_DEPRECATIONS[norm_key]
- msg = f"The parameter `{norm_key}` is deprecated, {suggestion}"
- SetuptoolsDeprecationWarning.emit(
- "Deprecated config", msg, **kwargs # type: ignore
- )
+ if norm_key in TOOL_TABLE_REMOVALS:
+ suggestion = cleandoc(TOOL_TABLE_REMOVALS[norm_key])
+ msg = f"""
+ The parameter `tool.setuptools.{field}` was long deprecated
+ and has been removed from `pyproject.toml`.
+ """
+ raise RemovedConfigError("\n".join([cleandoc(msg), suggestion]))
norm_key = TOOL_TABLE_RENAMES.get(norm_key, norm_key)
_set_config(dist, norm_key, value)
@@ -105,13 +108,13 @@ def _apply_tool_table(dist: "Distribution", config: dict, filename: _Path):
def _handle_missing_dynamic(dist: "Distribution", project_table: dict):
"""Be temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``"""
- # TODO: Set fields back to `None` once the feature stabilizes
dynamic = set(project_table.get("dynamic", []))
for field, getter in _PREVIOUSLY_DEFINED.items():
if not (field in project_table or field in dynamic):
value = getter(dist)
if value:
- _WouldIgnoreField.emit(field=field, value=value)
+ _MissingDynamic.emit(field=field, value=value)
+ project_table[field] = _RESET_PREVIOUSLY_DEFINED.get(field)
def json_compatible_key(key: str) -> str:
@@ -226,14 +229,18 @@ def _unify_entry_points(project_table: dict):
renaming = {"scripts": "console_scripts", "gui_scripts": "gui_scripts"}
for key, value in list(project.items()): # eager to allow modifications
norm_key = json_compatible_key(key)
- if norm_key in renaming and value:
+ if norm_key in renaming:
+ # Don't skip even if value is empty (reason: reset missing `dynamic`)
entry_points[renaming[norm_key]] = project.pop(key)
if entry_points:
project["entry-points"] = {
name: [f"{k} = {v}" for k, v in group.items()]
for name, group in entry_points.items()
+ if group # now we can skip empty groups
}
+ # Sometimes this will set `project["entry-points"] = {}`, and that is
+ # intentional (for reseting configurations that are missing `dynamic`).
def _copy_command_options(pyproject: dict, dist: "Distribution", filename: _Path):
@@ -353,11 +360,11 @@ PYPROJECT_CORRESPONDENCE: Dict[str, _Correspondence] = {
}
TOOL_TABLE_RENAMES = {"script_files": "scripts"}
-TOOL_TABLE_DEPRECATIONS = {
- "namespace_packages": (
- "consider using implicit namespaces instead (PEP 420).",
- {"due_date": (2023, 10, 30)}, # warning introduced in May 2022
- )
+TOOL_TABLE_REMOVALS = {
+ "namespace_packages": """
+ Please migrate to implicit native namespaces instead.
+ See https://packaging.python.org/en/latest/guides/packaging-namespace-packages/.
+ """,
}
SETUPTOOLS_PATCHES = {
@@ -388,14 +395,27 @@ _PREVIOUSLY_DEFINED = {
}
-class _WouldIgnoreField(SetuptoolsDeprecationWarning):
- _SUMMARY = "`{field}` defined outside of `pyproject.toml` would be ignored."
+_RESET_PREVIOUSLY_DEFINED: dict = {
+ # Fix improper setting: given in `setup.py`, but not listed in `dynamic`
+ # dict: pyproject name => value to which reset
+ "license": {},
+ "authors": [],
+ "maintainers": [],
+ "keywords": [],
+ "classifiers": [],
+ "urls": {},
+ "entry-points": {},
+ "scripts": {},
+ "gui-scripts": {},
+ "dependencies": [],
+ "optional-dependencies": [],
+}
- _DETAILS = """
- ##########################################################################
- # configuration would be ignored/result in error due to `pyproject.toml` #
- ##########################################################################
+class _MissingDynamic(SetuptoolsWarning):
+ _SUMMARY = "`{field}` defined outside of `pyproject.toml` is ignored."
+
+ _DETAILS = """
The following seems to be defined outside of `pyproject.toml`:
`{field} = {value!r}`
@@ -405,12 +425,14 @@ class _WouldIgnoreField(SetuptoolsDeprecationWarning):
https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
- For the time being, `setuptools` will still consider the given value (as a
- **transitional** measure), but please note that future releases of setuptools will
- follow strictly the standard.
-
- To prevent this warning, you can list `{field}` under `dynamic` or alternatively
+ To prevent this problem, you can list `{field}` under `dynamic` or alternatively
remove the `[project]` table from your file and rely entirely on other means of
configuration.
"""
- _DUE_DATE = (2023, 10, 30) # Initially introduced in 27 May 2022
+ # TODO: Consider removing this check in the future?
+ # There is a trade-off here between improving "debug-ability" and the cost
+ # of running/testing/maintaining these unnecessary checks...
+
+ @classmethod
+ def details(cls, field: str, value: Any) -> str:
+ return cls._DETAILS.format(field=field, value=value)
diff --git a/contrib/python/setuptools/py3/setuptools/config/expand.py b/contrib/python/setuptools/py3/setuptools/config/expand.py
index 518f5ac260..1bc71de546 100644
--- a/contrib/python/setuptools/py3/setuptools/config/expand.py
+++ b/contrib/python/setuptools/py3/setuptools/config/expand.py
@@ -19,7 +19,6 @@ functions among several configuration file formats.
"""
import ast
import importlib
-import io
import os
import pathlib
import sys
@@ -147,7 +146,7 @@ def _filter_existing_files(filepaths: Iterable[_Path]) -> Iterator[_Path]:
def _read_file(filepath: Union[bytes, _Path]) -> str:
- with io.open(filepath, encoding='utf-8') as f:
+ with open(filepath, encoding='utf-8') as f:
return f.read()
diff --git a/contrib/python/setuptools/py3/setuptools/config/pyprojecttoml.py b/contrib/python/setuptools/py3/setuptools/config/pyprojecttoml.py
index 93dbd9f559..379ef222f9 100644
--- a/contrib/python/setuptools/py3/setuptools/config/pyprojecttoml.py
+++ b/contrib/python/setuptools/py3/setuptools/config/pyprojecttoml.py
@@ -14,10 +14,10 @@ from contextlib import contextmanager
from functools import partial
from typing import TYPE_CHECKING, Callable, Dict, Mapping, Optional, Set, Union
-from ..errors import FileError, OptionError
+from ..errors import FileError, InvalidConfigError
from ..warnings import SetuptoolsWarning
from . import expand as _expand
-from ._apply_pyprojecttoml import _PREVIOUSLY_DEFINED, _WouldIgnoreField
+from ._apply_pyprojecttoml import _PREVIOUSLY_DEFINED, _MissingDynamic
from ._apply_pyprojecttoml import apply as _apply
if TYPE_CHECKING:
@@ -265,7 +265,7 @@ class _ConfigExpander:
"Some dynamic fields need to be specified via `tool.setuptools.dynamic`"
"\nothers must be specified via the equivalent attribute in `setup.py`."
)
- raise OptionError(msg)
+ raise InvalidConfigError(msg)
def _expand_directive(
self, specifier: str, directive, package_dir: Mapping[str, str]
@@ -330,9 +330,7 @@ class _ConfigExpander:
if group in groups:
value = groups.pop(group)
if field not in self.dynamic:
- _WouldIgnoreField.emit(field=field, value=value)
- # TODO: Don't set field when support for pyproject.toml stabilizes
- # instead raise an error as specified in PEP 621
+ raise InvalidConfigError(_MissingDynamic.details(field, value))
expanded[field] = value
_set_scripts("scripts", "console_scripts")
diff --git a/contrib/python/setuptools/py3/setuptools/config/setupcfg.py b/contrib/python/setuptools/py3/setuptools/config/setupcfg.py
index bb35559069..1a0e4154b9 100644
--- a/contrib/python/setuptools/py3/setuptools/config/setupcfg.py
+++ b/contrib/python/setuptools/py3/setuptools/config/setupcfg.py
@@ -556,23 +556,9 @@ class ConfigMetadataHandler(ConfigHandler["DistributionMetadata"]):
'platforms': parse_list,
'keywords': parse_list,
'provides': parse_list,
- 'requires': self._deprecated_config_handler(
- parse_list,
- "The requires parameter is deprecated, please use "
- "install_requires for runtime dependencies.",
- due_date=(2023, 10, 30),
- # Warning introduced in 27 Oct 2018
- ),
'obsoletes': parse_list,
'classifiers': self._get_parser_compound(parse_file, parse_list),
'license': exclude_files_parser('license'),
- 'license_file': self._deprecated_config_handler(
- exclude_files_parser('license_file'),
- "The license_file parameter is deprecated, "
- "use license_files instead.",
- due_date=(2023, 10, 30),
- # Warning introduced in 23 May 2021
- ),
'license_files': parse_list,
'description': parse_file,
'long_description': parse_file,
diff --git a/contrib/python/setuptools/py3/setuptools/dep_util.py b/contrib/python/setuptools/py3/setuptools/dep_util.py
index dc9ccf62c2..e30cd41b49 100644
--- a/contrib/python/setuptools/py3/setuptools/dep_util.py
+++ b/contrib/python/setuptools/py3/setuptools/dep_util.py
@@ -1,24 +1,14 @@
-from distutils.dep_util import newer_group
+import warnings
+from ._distutils import _modified
-# yes, this is was almost entirely copy-pasted from
-# 'newer_pairwise()', this is just another convenience
-# function.
-def newer_pairwise_group(sources_groups, targets):
- """Walk both arguments in parallel, testing if each source group is newer
- than its corresponding target. Returns a pair of lists (sources_groups,
- targets) where sources is newer than target, according to the semantics
- of 'newer_group()'.
- """
- if len(sources_groups) != len(targets):
- raise ValueError("'sources_group' and 'targets' must be the same length")
- # build a pair of lists (sources_groups, targets) where source is newer
- n_sources = []
- n_targets = []
- for i in range(len(sources_groups)):
- if newer_group(sources_groups[i], targets[i]):
- n_sources.append(sources_groups[i])
- n_targets.append(targets[i])
-
- return n_sources, n_targets
+def __getattr__(name):
+ if name not in ['newer_pairwise_group']:
+ raise AttributeError(name)
+ warnings.warn(
+ "dep_util is Deprecated. Use functions from setuptools.modified instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ return getattr(_modified, name)
diff --git a/contrib/python/setuptools/py3/setuptools/depends.py b/contrib/python/setuptools/py3/setuptools/depends.py
index 180e820459..42907d9bd4 100644
--- a/contrib/python/setuptools/py3/setuptools/depends.py
+++ b/contrib/python/setuptools/py3/setuptools/depends.py
@@ -142,9 +142,9 @@ def extract_constant(code, symbol, default=-1):
name_idx = list(code.co_names).index(symbol)
- STORE_NAME = 90
- STORE_GLOBAL = 97
- LOAD_CONST = 100
+ STORE_NAME = dis.opmap['STORE_NAME']
+ STORE_GLOBAL = dis.opmap['STORE_GLOBAL']
+ LOAD_CONST = dis.opmap['LOAD_CONST']
const = default
diff --git a/contrib/python/setuptools/py3/setuptools/dist.py b/contrib/python/setuptools/py3/setuptools/dist.py
index 2672f928d5..222e8a7623 100644
--- a/contrib/python/setuptools/py3/setuptools/dist.py
+++ b/contrib/python/setuptools/py3/setuptools/dist.py
@@ -26,7 +26,7 @@ from .extern.more_itertools import partition, unique_everseen
from .extern.ordered_set import OrderedSet
from .extern.packaging.markers import InvalidMarker, Marker
from .extern.packaging.specifiers import InvalidSpecifier, SpecifierSet
-from .extern.packaging.version import InvalidVersion, Version
+from .extern.packaging.version import Version
from . import _entry_points
from . import _normalization
@@ -311,9 +311,7 @@ class Distribution(_Distribution):
self._set_metadata_defaults(attrs)
- self.metadata.version = self._normalize_version(
- self._validate_version(self.metadata.version)
- )
+ self.metadata.version = self._normalize_version(self.metadata.version)
self._finalize_requires()
def _validate_metadata(self):
@@ -343,7 +341,10 @@ class Distribution(_Distribution):
def _normalize_version(version):
from . import sic
- if isinstance(version, sic) or version is None:
+ if isinstance(version, numbers.Number):
+ # Some people apparently take "version number" too literally :)
+ version = str(version)
+ elif isinstance(version, sic) or version is None:
return version
normalized = str(Version(version))
@@ -352,33 +353,6 @@ class Distribution(_Distribution):
return normalized
return version
- @staticmethod
- def _validate_version(version):
- if isinstance(version, numbers.Number):
- # Some people apparently take "version number" too literally :)
- version = str(version)
-
- if version is not None:
- try:
- Version(version)
- except (InvalidVersion, TypeError):
- from . import sic
-
- SetuptoolsDeprecationWarning.emit(
- f"Invalid version: {version!r}.",
- """
- The version specified is not a valid version according to PEP 440.
- This may not work as expected with newer versions of
- setuptools, pip, and PyPI.
- """,
- see_url="https://peps.python.org/pep-0440/",
- due_date=(2023, 9, 26),
- # Warning initially introduced in 26 Sept 2014
- # pypa/packaging already removed legacy versions.
- )
- return sic(version)
- return version
-
def _finalize_requires(self):
"""
Set `metadata.python_requires` and fix environment markers
@@ -482,7 +456,7 @@ class Distribution(_Distribution):
parser = ConfigParser()
parser.optionxform = str
for filename in filenames:
- with io.open(filename, encoding='utf-8') as reader:
+ with open(filename, encoding='utf-8') as reader:
if DEBUG:
self.announce(" reading {filename}".format(**locals()))
parser.read_file(reader)
@@ -550,7 +524,7 @@ class Distribution(_Distribution):
versions. Please use the underscore name {underscore_opt!r} instead.
""",
see_docs="userguide/declarative_config.html",
- due_date=(2023, 9, 26),
+ due_date=(2024, 9, 26),
# Warning initially introduced in 3 Mar 2021
)
return underscore_opt
@@ -574,7 +548,7 @@ class Distribution(_Distribution):
future versions. Please use lowercase {lowercase_opt!r} instead.
""",
see_docs="userguide/declarative_config.html",
- due_date=(2023, 9, 26),
+ due_date=(2024, 9, 26),
# Warning initially introduced in 6 Mar 2021
)
return lowercase_opt
diff --git a/contrib/python/setuptools/py3/setuptools/errors.py b/contrib/python/setuptools/py3/setuptools/errors.py
index ec7fb3b6c4..67a5a1df10 100644
--- a/contrib/python/setuptools/py3/setuptools/errors.py
+++ b/contrib/python/setuptools/py3/setuptools/errors.py
@@ -29,6 +29,14 @@ UnknownFileError = _distutils_errors.UnknownFileError
BaseError = _distutils_errors.DistutilsError
+class InvalidConfigError(OptionError):
+ """Error used for invalid configurations."""
+
+
+class RemovedConfigError(OptionError):
+ """Error used for configurations that were deprecated and removed."""
+
+
class RemovedCommandError(BaseError, RuntimeError):
"""Error used for commands that have been removed in setuptools.
diff --git a/contrib/python/setuptools/py3/setuptools/modified.py b/contrib/python/setuptools/py3/setuptools/modified.py
new file mode 100644
index 0000000000..af6ceeac89
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/modified.py
@@ -0,0 +1,8 @@
+from ._distutils._modified import (
+ newer,
+ newer_pairwise,
+ newer_group,
+ newer_pairwise_group,
+)
+
+__all__ = ['newer', 'newer_pairwise', 'newer_group', 'newer_pairwise_group']
diff --git a/contrib/python/setuptools/py3/setuptools/monkey.py b/contrib/python/setuptools/py3/setuptools/monkey.py
index 2ab98c178a..6c8a2f12f6 100644
--- a/contrib/python/setuptools/py3/setuptools/monkey.py
+++ b/contrib/python/setuptools/py3/setuptools/monkey.py
@@ -69,7 +69,7 @@ def patch_all():
has_issue_12885 = sys.version_info <= (3, 5, 3)
if has_issue_12885:
- # fix findall bug in distutils (http://bugs.python.org/issue12885)
+ # fix findall bug in distutils (https://bugs.python.org/issue12885)
distutils.filelist.findall = setuptools.findall
needs_warehouse = (3, 4) < sys.version_info < (3, 4, 6) or (
diff --git a/contrib/python/setuptools/py3/setuptools/msvc.py b/contrib/python/setuptools/py3/setuptools/msvc.py
index 5785c16945..a910a64b68 100644
--- a/contrib/python/setuptools/py3/setuptools/msvc.py
+++ b/contrib/python/setuptools/py3/setuptools/msvc.py
@@ -567,17 +567,17 @@ class RegistryInfo:
bkey = None
try:
bkey = openkey(hkey, ms(key), 0, key_read)
- except (OSError, IOError):
+ except OSError:
if not self.pi.current_is_x86():
try:
bkey = openkey(hkey, ms(key, True), 0, key_read)
- except (OSError, IOError):
+ except OSError:
continue
else:
continue
try:
return winreg.QueryValueEx(bkey, name)[0]
- except (OSError, IOError):
+ except OSError:
pass
finally:
if bkey:
@@ -646,7 +646,7 @@ class SystemInfo:
for hkey, key in itertools.product(self.ri.HKEYS, vckeys):
try:
bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ)
- except (OSError, IOError):
+ except OSError:
continue
with bkey:
subkeys, values, _ = winreg.QueryInfoKey(bkey)
@@ -678,7 +678,7 @@ class SystemInfo:
try:
hashed_names = listdir(instances_dir)
- except (OSError, IOError):
+ except OSError:
# Directory not exists with all Visual Studio versions
return vs_versions
@@ -698,7 +698,7 @@ class SystemInfo:
self._as_float_version(state['installationVersion'])
] = vs_path
- except (OSError, IOError, KeyError):
+ except (OSError, KeyError):
# Skip if "state.json" file is missing or bad format
continue
@@ -784,7 +784,7 @@ class SystemInfo:
vc_ver = listdir(guess_vc)[-1]
self.vc_ver = self._as_float_version(vc_ver)
return join(guess_vc, vc_ver)
- except (OSError, IOError, IndexError):
+ except (OSError, IndexError):
return ''
def _guess_vc_legacy(self):
diff --git a/contrib/python/setuptools/py3/setuptools/package_index.py b/contrib/python/setuptools/py3/setuptools/package_index.py
index 7095585008..3cedd5105c 100644
--- a/contrib/python/setuptools/py3/setuptools/package_index.py
+++ b/contrib/python/setuptools/py3/setuptools/package_index.py
@@ -806,7 +806,7 @@ class PackageIndex(Environment):
'%s returned a bad status line. The server might be '
'down, %s' % (url, v.line)
) from v
- except (http.client.HTTPException, socket.error) as v:
+ except (http.client.HTTPException, OSError) as v:
if warning:
self.warn(warning, v)
else:
diff --git a/contrib/python/setuptools/py3/setuptools/windows_support.py b/contrib/python/setuptools/py3/setuptools/windows_support.py
index fdadeb597c..8299ac1cdf 100644
--- a/contrib/python/setuptools/py3/setuptools/windows_support.py
+++ b/contrib/python/setuptools/py3/setuptools/windows_support.py
@@ -12,7 +12,7 @@ def hide_file(path):
"""
Set the hidden attribute on a file or directory.
- From http://stackoverflow.com/questions/19622133/
+ From https://stackoverflow.com/questions/19622133/
`path` must be text.
"""
diff --git a/contrib/python/setuptools/py3/ya.make b/contrib/python/setuptools/py3/ya.make
index 53547cd47e..fcc340f215 100644
--- a/contrib/python/setuptools/py3/ya.make
+++ b/contrib/python/setuptools/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(68.2.2)
+VERSION(69.0.0)
LICENSE(MIT)
@@ -38,8 +38,11 @@ PY_SRCS(
pkg_resources/_vendor/jaraco/functools.py
pkg_resources/_vendor/jaraco/text/__init__.py
pkg_resources/_vendor/more_itertools/__init__.py
+ pkg_resources/_vendor/more_itertools/__init__.pyi
pkg_resources/_vendor/more_itertools/more.py
+ pkg_resources/_vendor/more_itertools/more.pyi
pkg_resources/_vendor/more_itertools/recipes.py
+ pkg_resources/_vendor/more_itertools/recipes.pyi
pkg_resources/_vendor/packaging/__init__.py
pkg_resources/_vendor/packaging/_elffile.py
pkg_resources/_vendor/packaging/_manylinux.py
@@ -72,6 +75,7 @@ PY_SRCS(
setuptools/_distutils/_functools.py
setuptools/_distutils/_log.py
setuptools/_distutils/_macos_compat.py
+ setuptools/_distutils/_modified.py
setuptools/_distutils/_msvccompiler.py
setuptools/_distutils/archive_util.py
setuptools/_distutils/bcppcompiler.py
@@ -155,8 +159,11 @@ PY_SRCS(
setuptools/_vendor/jaraco/functools.py
setuptools/_vendor/jaraco/text/__init__.py
setuptools/_vendor/more_itertools/__init__.py
+ setuptools/_vendor/more_itertools/__init__.pyi
setuptools/_vendor/more_itertools/more.py
+ setuptools/_vendor/more_itertools/more.pyi
setuptools/_vendor/more_itertools/recipes.py
+ setuptools/_vendor/more_itertools/recipes.pyi
setuptools/_vendor/ordered_set.py
setuptools/_vendor/packaging/__init__.py
setuptools/_vendor/packaging/_elffile.py
@@ -228,6 +235,7 @@ PY_SRCS(
setuptools/installer.py
setuptools/launch.py
setuptools/logging.py
+ setuptools/modified.py
setuptools/monkey.py
setuptools/msvc.py
setuptools/namespaces.py
@@ -246,6 +254,15 @@ RESOURCE_FILES(
.dist-info/METADATA
.dist-info/entry_points.txt
.dist-info/top_level.txt
+ pkg_resources/_vendor/importlib_resources/py.typed
+ pkg_resources/_vendor/more_itertools/py.typed
+ pkg_resources/_vendor/packaging/py.typed
+ pkg_resources/_vendor/platformdirs/py.typed
+ setuptools/_vendor/importlib_metadata/py.typed
+ setuptools/_vendor/importlib_resources/py.typed
+ setuptools/_vendor/more_itertools/py.typed
+ setuptools/_vendor/packaging/py.typed
+ setuptools/_vendor/tomli/py.typed
setuptools/script.tmpl
)