Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- python/Lib/site-packages/setuptools/__pycache__/archive_util.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/build_meta.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/depends.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/discovery.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/dist.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/errors.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/extension.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/glob.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/installer.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/launch.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/logging.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/modified.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/monkey.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/msvc.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/namespaces.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/__pycache__/unicode_utils.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/_distutils/__init__.py +14 -0
- python/Lib/site-packages/setuptools/_distutils/_log.py +3 -0
- python/Lib/site-packages/setuptools/_distutils/_macos_compat.py +12 -0
- python/Lib/site-packages/setuptools/_distutils/_modified.py +95 -0
- python/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +16 -0
- python/Lib/site-packages/setuptools/_distutils/versionpredicate.py +175 -0
- python/Lib/site-packages/setuptools/_distutils/zosccompiler.py +3 -0
- python/Lib/site-packages/setuptools/_vendor/.lock +0 -0
- python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/INSTALLER +1 -0
- python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/METADATA +270 -0
- python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/RECORD +11 -0
- python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/REQUESTED +0 -0
- python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/WHEEL +4 -0
- python/Lib/site-packages/setuptools/_vendor/tomli/__init__.py +8 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/INSTALLER +1 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/METADATA +69 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/RECORD +22 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/REQUESTED +0 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/WHEEL +4 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/entry_points.txt +6 -0
- python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/licenses/LICENSE.txt +21 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__init__.py +3 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__main__.py +25 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/bdist_wheel.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/macosx_libfile.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/metadata.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/wheelfile.cpython-313.pyc +0 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_bdist_wheel.py +616 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_commands/convert.py +337 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_commands/pack.py +84 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_commands/tags.py +140 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_commands/unpack.py +30 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_metadata.py +184 -0
- python/Lib/site-packages/setuptools/_vendor/wheel/_setuptools_logging.py +26 -0
python/Lib/site-packages/setuptools/__pycache__/archive_util.cpython-313.pyc
ADDED
|
Binary file (9.4 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/build_meta.cpython-313.pyc
ADDED
|
Binary file (25 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/depends.cpython-313.pyc
ADDED
|
Binary file (7.59 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/discovery.cpython-313.pyc
ADDED
|
Binary file (29.1 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/dist.cpython-313.pyc
ADDED
|
Binary file (52.6 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/errors.cpython-313.pyc
ADDED
|
Binary file (3.52 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/extension.cpython-313.pyc
ADDED
|
Binary file (6.85 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/glob.cpython-313.pyc
ADDED
|
Binary file (7.64 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/installer.cpython-313.pyc
ADDED
|
Binary file (8.11 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/launch.cpython-313.pyc
ADDED
|
Binary file (1.29 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/logging.cpython-313.pyc
ADDED
|
Binary file (2.08 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/modified.cpython-313.pyc
ADDED
|
Binary file (484 Bytes). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/monkey.cpython-313.pyc
ADDED
|
Binary file (5.21 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/msvc.cpython-313.pyc
ADDED
|
Binary file (57.2 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/namespaces.cpython-313.pyc
ADDED
|
Binary file (5.31 kB). View file
|
|
|
python/Lib/site-packages/setuptools/__pycache__/unicode_utils.cpython-313.pyc
ADDED
|
Binary file (4.34 kB). View file
|
|
|
python/Lib/site-packages/setuptools/_distutils/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import importlib
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
__version__, _, _ = sys.version.partition(' ')
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
try:
|
| 8 |
+
# Allow Debian and pkgsrc (only) to customize system
|
| 9 |
+
# behavior. Ref pypa/distutils#2 and pypa/distutils#16.
|
| 10 |
+
# This hook is deprecated and no other environments
|
| 11 |
+
# should use it.
|
| 12 |
+
importlib.import_module('_distutils_system_mod')
|
| 13 |
+
except ImportError:
|
| 14 |
+
pass
|
python/Lib/site-packages/setuptools/_distutils/_log.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
|
| 3 |
+
log = logging.getLogger()
|
python/Lib/site-packages/setuptools/_distutils/_macos_compat.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import importlib
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def bypass_compiler_fixup(cmd, args):
|
| 6 |
+
return cmd
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
if sys.platform == 'darwin':
|
| 10 |
+
compiler_fixup = importlib.import_module('_osx_support').compiler_fixup
|
| 11 |
+
else:
|
| 12 |
+
compiler_fixup = bypass_compiler_fixup
|
python/Lib/site-packages/setuptools/_distutils/_modified.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Timestamp comparison of files and groups of files."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import functools
|
| 6 |
+
import os.path
|
| 7 |
+
from collections.abc import Callable, Iterable
|
| 8 |
+
from typing import Literal, TypeVar
|
| 9 |
+
|
| 10 |
+
from jaraco.functools import splat
|
| 11 |
+
|
| 12 |
+
from .compat.py39 import zip_strict
|
| 13 |
+
from .errors import DistutilsFileError
|
| 14 |
+
|
| 15 |
+
_SourcesT = TypeVar(
|
| 16 |
+
"_SourcesT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
|
| 17 |
+
)
|
| 18 |
+
_TargetsT = TypeVar(
|
| 19 |
+
"_TargetsT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def _newer(source, target):
|
| 24 |
+
return not os.path.exists(target) or (
|
| 25 |
+
os.path.getmtime(source) > os.path.getmtime(target)
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def newer(
|
| 30 |
+
source: str | bytes | os.PathLike[str] | os.PathLike[bytes],
|
| 31 |
+
target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
|
| 32 |
+
) -> bool:
|
| 33 |
+
"""
|
| 34 |
+
Is source modified more recently than target.
|
| 35 |
+
|
| 36 |
+
Returns True if 'source' is modified more recently than
|
| 37 |
+
'target' or if 'target' does not exist.
|
| 38 |
+
|
| 39 |
+
Raises DistutilsFileError if 'source' does not exist.
|
| 40 |
+
"""
|
| 41 |
+
if not os.path.exists(source):
|
| 42 |
+
raise DistutilsFileError(f"file {os.path.abspath(source)!r} does not exist")
|
| 43 |
+
|
| 44 |
+
return _newer(source, target)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def newer_pairwise(
|
| 48 |
+
sources: Iterable[_SourcesT],
|
| 49 |
+
targets: Iterable[_TargetsT],
|
| 50 |
+
newer: Callable[[_SourcesT, _TargetsT], bool] = newer,
|
| 51 |
+
) -> tuple[list[_SourcesT], list[_TargetsT]]:
|
| 52 |
+
"""
|
| 53 |
+
Filter filenames where sources are newer than targets.
|
| 54 |
+
|
| 55 |
+
Walk two filename iterables in parallel, testing if each source is newer
|
| 56 |
+
than its corresponding target. Returns a pair of lists (sources,
|
| 57 |
+
targets) where source is newer than target, according to the semantics
|
| 58 |
+
of 'newer()'.
|
| 59 |
+
"""
|
| 60 |
+
newer_pairs = filter(splat(newer), zip_strict(sources, targets))
|
| 61 |
+
return tuple(map(list, zip(*newer_pairs))) or ([], [])
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def newer_group(
|
| 65 |
+
sources: Iterable[str | bytes | os.PathLike[str] | os.PathLike[bytes]],
|
| 66 |
+
target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
|
| 67 |
+
missing: Literal["error", "ignore", "newer"] = "error",
|
| 68 |
+
) -> bool:
|
| 69 |
+
"""
|
| 70 |
+
Is target out-of-date with respect to any file in sources.
|
| 71 |
+
|
| 72 |
+
Return True if 'target' is out-of-date with respect to any file
|
| 73 |
+
listed in 'sources'. In other words, if 'target' exists and is newer
|
| 74 |
+
than every file in 'sources', return False; otherwise return True.
|
| 75 |
+
``missing`` controls how to handle a missing source file:
|
| 76 |
+
|
| 77 |
+
- error (default): allow the ``stat()`` call to fail.
|
| 78 |
+
- ignore: silently disregard any missing source files.
|
| 79 |
+
- newer: treat missing source files as "target out of date". This
|
| 80 |
+
mode is handy in "dry-run" mode: it will pretend to carry out
|
| 81 |
+
commands that wouldn't work because inputs are missing, but
|
| 82 |
+
that doesn't matter because dry-run won't run the commands.
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
+
def missing_as_newer(source):
|
| 86 |
+
return missing == 'newer' and not os.path.exists(source)
|
| 87 |
+
|
| 88 |
+
ignored = os.path.exists if missing == 'ignore' else None
|
| 89 |
+
return not os.path.exists(target) or any(
|
| 90 |
+
missing_as_newer(source) or _newer(source, target)
|
| 91 |
+
for source in filter(ignored, sources)
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
newer_pairwise_group = functools.partial(newer_pairwise, newer=newer_group)
|
python/Lib/site-packages/setuptools/_distutils/_msvccompiler.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
|
| 3 |
+
from .compilers.C import msvc
|
| 4 |
+
|
| 5 |
+
__all__ = ["MSVCCompiler"]
|
| 6 |
+
|
| 7 |
+
MSVCCompiler = msvc.Compiler
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def __getattr__(name):
|
| 11 |
+
if name == '_get_vc_env':
|
| 12 |
+
warnings.warn(
|
| 13 |
+
"_get_vc_env is private; find an alternative (pypa/distutils#340)"
|
| 14 |
+
)
|
| 15 |
+
return msvc._get_vc_env
|
| 16 |
+
raise AttributeError(name)
|
python/Lib/site-packages/setuptools/_distutils/versionpredicate.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Module for parsing and testing package version predicate strings."""
|
| 2 |
+
|
| 3 |
+
import operator
|
| 4 |
+
import re
|
| 5 |
+
|
| 6 |
+
from . import version
|
| 7 |
+
|
| 8 |
+
re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)", re.ASCII)
|
| 9 |
+
# (package) (rest)
|
| 10 |
+
|
| 11 |
+
re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
|
| 12 |
+
re_splitComparison = re.compile(r"^\s*(<=|>=|<|>|!=|==)\s*([^\s,]+)\s*$")
|
| 13 |
+
# (comp) (version)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def splitUp(pred):
|
| 17 |
+
"""Parse a single version comparison.
|
| 18 |
+
|
| 19 |
+
Return (comparison string, StrictVersion)
|
| 20 |
+
"""
|
| 21 |
+
res = re_splitComparison.match(pred)
|
| 22 |
+
if not res:
|
| 23 |
+
raise ValueError(f"bad package restriction syntax: {pred!r}")
|
| 24 |
+
comp, verStr = res.groups()
|
| 25 |
+
with version.suppress_known_deprecation():
|
| 26 |
+
other = version.StrictVersion(verStr)
|
| 27 |
+
return (comp, other)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
compmap = {
|
| 31 |
+
"<": operator.lt,
|
| 32 |
+
"<=": operator.le,
|
| 33 |
+
"==": operator.eq,
|
| 34 |
+
">": operator.gt,
|
| 35 |
+
">=": operator.ge,
|
| 36 |
+
"!=": operator.ne,
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class VersionPredicate:
|
| 41 |
+
"""Parse and test package version predicates.
|
| 42 |
+
|
| 43 |
+
>>> v = VersionPredicate('pyepat.abc (>1.0, <3333.3a1, !=1555.1b3)')
|
| 44 |
+
|
| 45 |
+
The `name` attribute provides the full dotted name that is given::
|
| 46 |
+
|
| 47 |
+
>>> v.name
|
| 48 |
+
'pyepat.abc'
|
| 49 |
+
|
| 50 |
+
The str() of a `VersionPredicate` provides a normalized
|
| 51 |
+
human-readable version of the expression::
|
| 52 |
+
|
| 53 |
+
>>> print(v)
|
| 54 |
+
pyepat.abc (> 1.0, < 3333.3a1, != 1555.1b3)
|
| 55 |
+
|
| 56 |
+
The `satisfied_by()` method can be used to determine with a given
|
| 57 |
+
version number is included in the set described by the version
|
| 58 |
+
restrictions::
|
| 59 |
+
|
| 60 |
+
>>> v.satisfied_by('1.1')
|
| 61 |
+
True
|
| 62 |
+
>>> v.satisfied_by('1.4')
|
| 63 |
+
True
|
| 64 |
+
>>> v.satisfied_by('1.0')
|
| 65 |
+
False
|
| 66 |
+
>>> v.satisfied_by('4444.4')
|
| 67 |
+
False
|
| 68 |
+
>>> v.satisfied_by('1555.1b3')
|
| 69 |
+
False
|
| 70 |
+
|
| 71 |
+
`VersionPredicate` is flexible in accepting extra whitespace::
|
| 72 |
+
|
| 73 |
+
>>> v = VersionPredicate(' pat( == 0.1 ) ')
|
| 74 |
+
>>> v.name
|
| 75 |
+
'pat'
|
| 76 |
+
>>> v.satisfied_by('0.1')
|
| 77 |
+
True
|
| 78 |
+
>>> v.satisfied_by('0.2')
|
| 79 |
+
False
|
| 80 |
+
|
| 81 |
+
If any version numbers passed in do not conform to the
|
| 82 |
+
restrictions of `StrictVersion`, a `ValueError` is raised::
|
| 83 |
+
|
| 84 |
+
>>> v = VersionPredicate('p1.p2.p3.p4(>=1.0, <=1.3a1, !=1.2zb3)')
|
| 85 |
+
Traceback (most recent call last):
|
| 86 |
+
...
|
| 87 |
+
ValueError: invalid version number '1.2zb3'
|
| 88 |
+
|
| 89 |
+
It the module or package name given does not conform to what's
|
| 90 |
+
allowed as a legal module or package name, `ValueError` is
|
| 91 |
+
raised::
|
| 92 |
+
|
| 93 |
+
>>> v = VersionPredicate('foo-bar')
|
| 94 |
+
Traceback (most recent call last):
|
| 95 |
+
...
|
| 96 |
+
ValueError: expected parenthesized list: '-bar'
|
| 97 |
+
|
| 98 |
+
>>> v = VersionPredicate('foo bar (12.21)')
|
| 99 |
+
Traceback (most recent call last):
|
| 100 |
+
...
|
| 101 |
+
ValueError: expected parenthesized list: 'bar (12.21)'
|
| 102 |
+
|
| 103 |
+
"""
|
| 104 |
+
|
| 105 |
+
def __init__(self, versionPredicateStr):
|
| 106 |
+
"""Parse a version predicate string."""
|
| 107 |
+
# Fields:
|
| 108 |
+
# name: package name
|
| 109 |
+
# pred: list of (comparison string, StrictVersion)
|
| 110 |
+
|
| 111 |
+
versionPredicateStr = versionPredicateStr.strip()
|
| 112 |
+
if not versionPredicateStr:
|
| 113 |
+
raise ValueError("empty package restriction")
|
| 114 |
+
match = re_validPackage.match(versionPredicateStr)
|
| 115 |
+
if not match:
|
| 116 |
+
raise ValueError(f"bad package name in {versionPredicateStr!r}")
|
| 117 |
+
self.name, paren = match.groups()
|
| 118 |
+
paren = paren.strip()
|
| 119 |
+
if paren:
|
| 120 |
+
match = re_paren.match(paren)
|
| 121 |
+
if not match:
|
| 122 |
+
raise ValueError(f"expected parenthesized list: {paren!r}")
|
| 123 |
+
str = match.groups()[0]
|
| 124 |
+
self.pred = [splitUp(aPred) for aPred in str.split(",")]
|
| 125 |
+
if not self.pred:
|
| 126 |
+
raise ValueError(f"empty parenthesized list in {versionPredicateStr!r}")
|
| 127 |
+
else:
|
| 128 |
+
self.pred = []
|
| 129 |
+
|
| 130 |
+
def __str__(self):
|
| 131 |
+
if self.pred:
|
| 132 |
+
seq = [cond + " " + str(ver) for cond, ver in self.pred]
|
| 133 |
+
return self.name + " (" + ", ".join(seq) + ")"
|
| 134 |
+
else:
|
| 135 |
+
return self.name
|
| 136 |
+
|
| 137 |
+
def satisfied_by(self, version):
|
| 138 |
+
"""True if version is compatible with all the predicates in self.
|
| 139 |
+
The parameter version must be acceptable to the StrictVersion
|
| 140 |
+
constructor. It may be either a string or StrictVersion.
|
| 141 |
+
"""
|
| 142 |
+
for cond, ver in self.pred:
|
| 143 |
+
if not compmap[cond](version, ver):
|
| 144 |
+
return False
|
| 145 |
+
return True
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
_provision_rx = None
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def split_provision(value):
|
| 152 |
+
"""Return the name and optional version number of a provision.
|
| 153 |
+
|
| 154 |
+
The version number, if given, will be returned as a `StrictVersion`
|
| 155 |
+
instance, otherwise it will be `None`.
|
| 156 |
+
|
| 157 |
+
>>> split_provision('mypkg')
|
| 158 |
+
('mypkg', None)
|
| 159 |
+
>>> split_provision(' mypkg( 1.2 ) ')
|
| 160 |
+
('mypkg', StrictVersion ('1.2'))
|
| 161 |
+
"""
|
| 162 |
+
global _provision_rx
|
| 163 |
+
if _provision_rx is None:
|
| 164 |
+
_provision_rx = re.compile(
|
| 165 |
+
r"([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$", re.ASCII
|
| 166 |
+
)
|
| 167 |
+
value = value.strip()
|
| 168 |
+
m = _provision_rx.match(value)
|
| 169 |
+
if not m:
|
| 170 |
+
raise ValueError(f"illegal provides specification: {value!r}")
|
| 171 |
+
ver = m.group(2) or None
|
| 172 |
+
if ver:
|
| 173 |
+
with version.suppress_known_deprecation():
|
| 174 |
+
ver = version.StrictVersion(ver)
|
| 175 |
+
return m.group(1), ver
|
python/Lib/site-packages/setuptools/_distutils/zosccompiler.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .compilers.C import zos
|
| 2 |
+
|
| 3 |
+
zOSCCompiler = zos.Compiler
|
python/Lib/site-packages/setuptools/_vendor/.lock
ADDED
|
File without changes
|
python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: tomli
|
| 3 |
+
Version: 2.4.0
|
| 4 |
+
Summary: A lil' TOML parser
|
| 5 |
+
Keywords: toml
|
| 6 |
+
Author-email: Taneli Hukkinen <hukkin@users.noreply.github.com>
|
| 7 |
+
Requires-Python: >=3.8
|
| 8 |
+
Description-Content-Type: text/markdown
|
| 9 |
+
License-Expression: MIT
|
| 10 |
+
Classifier: Operating System :: MacOS
|
| 11 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 12 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 13 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 14 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 15 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 16 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 17 |
+
Classifier: Typing :: Typed
|
| 18 |
+
License-File: LICENSE
|
| 19 |
+
Project-URL: Changelog, https://github.com/hukkin/tomli/blob/master/CHANGELOG.md
|
| 20 |
+
Project-URL: Homepage, https://github.com/hukkin/tomli
|
| 21 |
+
|
| 22 |
+
[](https://github.com/hukkin/tomli/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush)
|
| 23 |
+
[](https://codecov.io/gh/hukkin/tomli)
|
| 24 |
+
[](https://pypi.org/project/tomli)
|
| 25 |
+
|
| 26 |
+
# Tomli
|
| 27 |
+
|
| 28 |
+
> A lil' TOML parser
|
| 29 |
+
|
| 30 |
+
**Table of Contents** *generated with [mdformat-toc](https://github.com/hukkin/mdformat-toc)*
|
| 31 |
+
|
| 32 |
+
<!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=2 -->
|
| 33 |
+
|
| 34 |
+
- [Intro](#intro)
|
| 35 |
+
- [Installation](#installation)
|
| 36 |
+
- [Usage](#usage)
|
| 37 |
+
- [Parse a TOML string](#parse-a-toml-string)
|
| 38 |
+
- [Parse a TOML file](#parse-a-toml-file)
|
| 39 |
+
- [Handle invalid TOML](#handle-invalid-toml)
|
| 40 |
+
- [Construct `decimal.Decimal`s from TOML floats](#construct-decimaldecimals-from-toml-floats)
|
| 41 |
+
- [Building a `tomli`/`tomllib` compatibility layer](#building-a-tomlitomllib-compatibility-layer)
|
| 42 |
+
- [FAQ](#faq)
|
| 43 |
+
- [Why this parser?](#why-this-parser)
|
| 44 |
+
- [Is comment preserving round-trip parsing supported?](#is-comment-preserving-round-trip-parsing-supported)
|
| 45 |
+
- [Is there a `dumps`, `write` or `encode` function?](#is-there-a-dumps-write-or-encode-function)
|
| 46 |
+
- [How do TOML types map into Python types?](#how-do-toml-types-map-into-python-types)
|
| 47 |
+
- [Performance](#performance)
|
| 48 |
+
- [Pure Python](#pure-python)
|
| 49 |
+
- [Mypyc generated wheel](#mypyc-generated-wheel)
|
| 50 |
+
|
| 51 |
+
<!-- mdformat-toc end -->
|
| 52 |
+
|
| 53 |
+
## Intro<a name="intro"></a>
|
| 54 |
+
|
| 55 |
+
Tomli is a Python library for parsing [TOML](https://toml.io).
|
| 56 |
+
Version 2.4.0 and later are compatible with [TOML v1.1.0](https://toml.io/en/v1.1.0).
|
| 57 |
+
Older versions are [TOML v1.0.0](https://toml.io/en/v1.0.0) compatible.
|
| 58 |
+
|
| 59 |
+
A version of Tomli, the `tomllib` module,
|
| 60 |
+
was added to the standard library in Python 3.11
|
| 61 |
+
via [PEP 680](https://www.python.org/dev/peps/pep-0680/).
|
| 62 |
+
Tomli continues to provide a backport on PyPI for Python versions
|
| 63 |
+
where the standard library module is not available
|
| 64 |
+
and that have not yet reached their end-of-life.
|
| 65 |
+
|
| 66 |
+
Tomli uses [mypyc](https://github.com/mypyc/mypyc)
|
| 67 |
+
to generate binary wheels for most of the widely used platforms,
|
| 68 |
+
so Python 3.11+ users may prefer it over `tomllib` for improved performance.
|
| 69 |
+
Pure Python wheels are available on any platform and should perform the same as `tomllib`.
|
| 70 |
+
|
| 71 |
+
## Installation<a name="installation"></a>
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
pip install tomli
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Usage<a name="usage"></a>
|
| 78 |
+
|
| 79 |
+
### Parse a TOML string<a name="parse-a-toml-string"></a>
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
import tomli
|
| 83 |
+
|
| 84 |
+
toml_str = """
|
| 85 |
+
[[players]]
|
| 86 |
+
name = "Lehtinen"
|
| 87 |
+
number = 26
|
| 88 |
+
|
| 89 |
+
[[players]]
|
| 90 |
+
name = "Numminen"
|
| 91 |
+
number = 27
|
| 92 |
+
"""
|
| 93 |
+
|
| 94 |
+
toml_dict = tomli.loads(toml_str)
|
| 95 |
+
assert toml_dict == {
|
| 96 |
+
"players": [{"name": "Lehtinen", "number": 26}, {"name": "Numminen", "number": 27}]
|
| 97 |
+
}
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
### Parse a TOML file<a name="parse-a-toml-file"></a>
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
import tomli
|
| 104 |
+
|
| 105 |
+
with open("path_to_file/conf.toml", "rb") as f:
|
| 106 |
+
toml_dict = tomli.load(f)
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
The file must be opened in binary mode (with the `"rb"` flag).
|
| 110 |
+
Binary mode will enforce decoding the file as UTF-8 with universal newlines disabled,
|
| 111 |
+
both of which are required to correctly parse TOML.
|
| 112 |
+
|
| 113 |
+
### Handle invalid TOML<a name="handle-invalid-toml"></a>
|
| 114 |
+
|
| 115 |
+
```python
|
| 116 |
+
import tomli
|
| 117 |
+
|
| 118 |
+
try:
|
| 119 |
+
toml_dict = tomli.loads("]] this is invalid TOML [[")
|
| 120 |
+
except tomli.TOMLDecodeError:
|
| 121 |
+
print("Yep, definitely not valid.")
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
Note that error messages are considered informational only.
|
| 125 |
+
They should not be assumed to stay constant across Tomli versions.
|
| 126 |
+
|
| 127 |
+
### Construct `decimal.Decimal`s from TOML floats<a name="construct-decimaldecimals-from-toml-floats"></a>
|
| 128 |
+
|
| 129 |
+
```python
|
| 130 |
+
from decimal import Decimal
|
| 131 |
+
import tomli
|
| 132 |
+
|
| 133 |
+
toml_dict = tomli.loads("precision-matters = 0.982492", parse_float=Decimal)
|
| 134 |
+
assert isinstance(toml_dict["precision-matters"], Decimal)
|
| 135 |
+
assert toml_dict["precision-matters"] == Decimal("0.982492")
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
Note that `decimal.Decimal` can be replaced with another callable that converts a TOML float from string to a Python type.
|
| 139 |
+
The `decimal.Decimal` is, however, a practical choice for use cases where float inaccuracies can not be tolerated.
|
| 140 |
+
|
| 141 |
+
Illegal types are `dict` and `list`, and their subtypes.
|
| 142 |
+
A `ValueError` will be raised if `parse_float` produces illegal types.
|
| 143 |
+
|
| 144 |
+
### Building a `tomli`/`tomllib` compatibility layer<a name="building-a-tomlitomllib-compatibility-layer"></a>
|
| 145 |
+
|
| 146 |
+
Python versions 3.11+ ship with a version of Tomli:
|
| 147 |
+
the `tomllib` standard library module.
|
| 148 |
+
To build code that uses the standard library if available,
|
| 149 |
+
but still works seamlessly with Python 3.6+,
|
| 150 |
+
do the following.
|
| 151 |
+
|
| 152 |
+
Instead of a hard Tomli dependency, use the following
|
| 153 |
+
[dependency specifier](https://packaging.python.org/en/latest/specifications/dependency-specifiers/)
|
| 154 |
+
to only require Tomli when the standard library module is not available:
|
| 155 |
+
|
| 156 |
+
```
|
| 157 |
+
tomli >= 1.1.0 ; python_version < "3.11"
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
Then, in your code, import a TOML parser using the following fallback mechanism:
|
| 161 |
+
|
| 162 |
+
```python
|
| 163 |
+
import sys
|
| 164 |
+
|
| 165 |
+
if sys.version_info >= (3, 11):
|
| 166 |
+
import tomllib
|
| 167 |
+
else:
|
| 168 |
+
import tomli as tomllib
|
| 169 |
+
|
| 170 |
+
tomllib.loads("['This parses fine with Python 3.6+']")
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
## FAQ<a name="faq"></a>
|
| 174 |
+
|
| 175 |
+
### Why this parser?<a name="why-this-parser"></a>
|
| 176 |
+
|
| 177 |
+
- it's lil'
|
| 178 |
+
- pure Python with zero dependencies
|
| 179 |
+
- the fastest pure Python parser [\*](#pure-python):
|
| 180 |
+
18x as fast as [tomlkit](https://pypi.org/project/tomlkit/),
|
| 181 |
+
2.1x as fast as [toml](https://pypi.org/project/toml/)
|
| 182 |
+
- outputs [basic data types](#how-do-toml-types-map-into-python-types) only
|
| 183 |
+
- 100% spec compliant: passes all tests in
|
| 184 |
+
[toml-lang/toml-test](https://github.com/toml-lang/toml-test)
|
| 185 |
+
test suite
|
| 186 |
+
- thoroughly tested: 100% branch coverage
|
| 187 |
+
|
| 188 |
+
### Is comment preserving round-trip parsing supported?<a name="is-comment-preserving-round-trip-parsing-supported"></a>
|
| 189 |
+
|
| 190 |
+
No.
|
| 191 |
+
|
| 192 |
+
The `tomli.loads` function returns a plain `dict` that is populated with builtin types and types from the standard library only.
|
| 193 |
+
Preserving comments requires a custom type to be returned so will not be supported,
|
| 194 |
+
at least not by the `tomli.loads` and `tomli.load` functions.
|
| 195 |
+
|
| 196 |
+
Look into [TOML Kit](https://github.com/sdispater/tomlkit) if preservation of style is what you need.
|
| 197 |
+
|
| 198 |
+
### Is there a `dumps`, `write` or `encode` function?<a name="is-there-a-dumps-write-or-encode-function"></a>
|
| 199 |
+
|
| 200 |
+
[Tomli-W](https://github.com/hukkin/tomli-w) is the write-only counterpart of Tomli, providing `dump` and `dumps` functions.
|
| 201 |
+
|
| 202 |
+
The core library does not include write capability, as most TOML use cases are read-only, and Tomli intends to be minimal.
|
| 203 |
+
|
| 204 |
+
### How do TOML types map into Python types?<a name="how-do-toml-types-map-into-python-types"></a>
|
| 205 |
+
|
| 206 |
+
| TOML type | Python type | Details |
|
| 207 |
+
| ---------------- | ------------------- | ------------------------------------------------------------ |
|
| 208 |
+
| Document Root | `dict` | |
|
| 209 |
+
| Key | `str` | |
|
| 210 |
+
| String | `str` | |
|
| 211 |
+
| Integer | `int` | |
|
| 212 |
+
| Float | `float` | |
|
| 213 |
+
| Boolean | `bool` | |
|
| 214 |
+
| Offset Date-Time | `datetime.datetime` | `tzinfo` attribute set to an instance of `datetime.timezone` |
|
| 215 |
+
| Local Date-Time | `datetime.datetime` | `tzinfo` attribute set to `None` |
|
| 216 |
+
| Local Date | `datetime.date` | |
|
| 217 |
+
| Local Time | `datetime.time` | |
|
| 218 |
+
| Array | `list` | |
|
| 219 |
+
| Table | `dict` | |
|
| 220 |
+
| Inline Table | `dict` | |
|
| 221 |
+
|
| 222 |
+
## Performance<a name="performance"></a>
|
| 223 |
+
|
| 224 |
+
The `benchmark/` folder in this repository contains a performance benchmark for comparing the various Python TOML parsers.
|
| 225 |
+
|
| 226 |
+
Below are the results for commit [0724e2a](https://github.com/hukkin/tomli/tree/0724e2ab1858da7f5e05a9bffdb24c33589d951c).
|
| 227 |
+
|
| 228 |
+
### Pure Python<a name="pure-python"></a>
|
| 229 |
+
|
| 230 |
+
```console
|
| 231 |
+
foo@bar:~/dev/tomli$ python --version
|
| 232 |
+
Python 3.12.7
|
| 233 |
+
foo@bar:~/dev/tomli$ pip freeze
|
| 234 |
+
attrs==21.4.0
|
| 235 |
+
click==8.1.7
|
| 236 |
+
pytomlpp==1.0.13
|
| 237 |
+
qtoml==0.3.1
|
| 238 |
+
rtoml==0.11.0
|
| 239 |
+
toml==0.10.2
|
| 240 |
+
tomli @ file:///home/foo/dev/tomli
|
| 241 |
+
tomlkit==0.13.2
|
| 242 |
+
foo@bar:~/dev/tomli$ python benchmark/run.py
|
| 243 |
+
Parsing data.toml 5000 times:
|
| 244 |
+
------------------------------------------------------
|
| 245 |
+
parser | exec time | performance (more is better)
|
| 246 |
+
-----------+------------+-----------------------------
|
| 247 |
+
rtoml | 0.647 s | baseline (100%)
|
| 248 |
+
pytomlpp | 0.891 s | 72.62%
|
| 249 |
+
tomli | 3.14 s | 20.56%
|
| 250 |
+
toml | 6.69 s | 9.67%
|
| 251 |
+
qtoml | 8.27 s | 7.82%
|
| 252 |
+
tomlkit | 56.1 s | 1.15%
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
### Mypyc generated wheel<a name="mypyc-generated-wheel"></a>
|
| 256 |
+
|
| 257 |
+
```console
|
| 258 |
+
foo@bar:~/dev/tomli$ python benchmark/run.py
|
| 259 |
+
Parsing data.toml 5000 times:
|
| 260 |
+
------------------------------------------------------
|
| 261 |
+
parser | exec time | performance (more is better)
|
| 262 |
+
-----------+------------+-----------------------------
|
| 263 |
+
rtoml | 0.668 s | baseline (100%)
|
| 264 |
+
pytomlpp | 0.893 s | 74.81%
|
| 265 |
+
tomli | 1.96 s | 34.18%
|
| 266 |
+
toml | 6.64 s | 10.07%
|
| 267 |
+
qtoml | 8.26 s | 8.09%
|
| 268 |
+
tomlkit | 52.9 s | 1.26%
|
| 269 |
+
```
|
| 270 |
+
|
python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tomli-2.4.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
tomli-2.4.0.dist-info/METADATA,sha256=9awKH4-6kItGRs1lUwnpGq2Wm2eHYWrFccpGKjgy_84,10567
|
| 3 |
+
tomli-2.4.0.dist-info/RECORD,,
|
| 4 |
+
tomli-2.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
tomli-2.4.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
| 6 |
+
tomli-2.4.0.dist-info/licenses/LICENSE,sha256=uAgWsNUwuKzLTCIReDeQmEpuO2GSLCte6S8zcqsnQv4,1072
|
| 7 |
+
tomli/__init__.py,sha256=ahtDjGJA2M_wWVvGpzx4YJtWxrWBx6qE-GH5-UYoECA,314
|
| 8 |
+
tomli/_parser.py,sha256=txeATLE3zHyZ-ushXtYfrZ3LoIs7JzQF2W2KL1gwJPg,25958
|
| 9 |
+
tomli/_re.py,sha256=oSNZ_ilFI6chEuQ01YRSoUydBQr_okF_mSdHTkFmv90,3396
|
| 10 |
+
tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254
|
| 11 |
+
tomli/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/REQUESTED
ADDED
|
File without changes
|
python/Lib/site-packages/setuptools/_vendor/tomli-2.4.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: flit 3.12.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
python/Lib/site-packages/setuptools/_vendor/tomli/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
|
| 3 |
+
# Licensed to PSF under a Contributor Agreement.
|
| 4 |
+
|
| 5 |
+
__all__ = ("loads", "load", "TOMLDecodeError")
|
| 6 |
+
__version__ = "2.4.0" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
|
| 7 |
+
|
| 8 |
+
from ._parser import TOMLDecodeError, load, loads
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/METADATA
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: wheel
|
| 3 |
+
Version: 0.46.3
|
| 4 |
+
Summary: Command line tool for manipulating wheel files
|
| 5 |
+
Keywords: wheel,packaging
|
| 6 |
+
Author-email: Daniel Holth <dholth@fastmail.fm>
|
| 7 |
+
Maintainer-email: Alex Grönholm <alex.gronholm@nextday.fi>
|
| 8 |
+
Requires-Python: >=3.9
|
| 9 |
+
Description-Content-Type: text/x-rst
|
| 10 |
+
License-Expression: MIT
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: Topic :: System :: Archiving :: Packaging
|
| 14 |
+
Classifier: Programming Language :: Python
|
| 15 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 22 |
+
License-File: LICENSE.txt
|
| 23 |
+
Requires-Dist: packaging >= 24.0
|
| 24 |
+
Requires-Dist: pytest >= 6.0.0 ; extra == "test"
|
| 25 |
+
Requires-Dist: setuptools >= 77 ; extra == "test"
|
| 26 |
+
Project-URL: Changelog, https://wheel.readthedocs.io/en/stable/news.html
|
| 27 |
+
Project-URL: Documentation, https://wheel.readthedocs.io/
|
| 28 |
+
Project-URL: Issue Tracker, https://github.com/pypa/wheel/issues
|
| 29 |
+
Project-URL: Source, https://github.com/pypa/wheel
|
| 30 |
+
Provides-Extra: test
|
| 31 |
+
|
| 32 |
+
wheel
|
| 33 |
+
=====
|
| 34 |
+
|
| 35 |
+
This is a command line tool for manipulating Python wheel files, as defined in
|
| 36 |
+
`PEP 427`_. It contains the following functionality:
|
| 37 |
+
|
| 38 |
+
* Convert ``.egg`` archives into ``.whl``
|
| 39 |
+
* Unpack wheel archives
|
| 40 |
+
* Repack wheel archives
|
| 41 |
+
* Add or remove tags in existing wheel archives
|
| 42 |
+
|
| 43 |
+
.. _PEP 427: https://www.python.org/dev/peps/pep-0427/
|
| 44 |
+
|
| 45 |
+
Historical note
|
| 46 |
+
---------------
|
| 47 |
+
|
| 48 |
+
This project used to contain the implementation of the setuptools_ ``bdist_wheel``
|
| 49 |
+
command, but as of setuptools v70.1, it no longer needs ``wheel`` installed for that to
|
| 50 |
+
work. Thus, you should install this **only** if you intend to use the ``wheel`` command
|
| 51 |
+
line tool!
|
| 52 |
+
|
| 53 |
+
.. _setuptools: https://pypi.org/project/setuptools/
|
| 54 |
+
|
| 55 |
+
Documentation
|
| 56 |
+
-------------
|
| 57 |
+
|
| 58 |
+
The documentation_ can be found on Read The Docs.
|
| 59 |
+
|
| 60 |
+
.. _documentation: https://wheel.readthedocs.io/
|
| 61 |
+
|
| 62 |
+
Code of Conduct
|
| 63 |
+
---------------
|
| 64 |
+
|
| 65 |
+
Everyone interacting in the wheel project's codebases, issue trackers, chat
|
| 66 |
+
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
| 67 |
+
|
| 68 |
+
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
| 69 |
+
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/RECORD
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
bin/wheel,sha256=OLjFs9G7MQ-f_mhuW2aLGpngsyphW_v5FIoyN88Hfk0,339
|
| 2 |
+
wheel-0.46.3.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 3 |
+
wheel-0.46.3.dist-info/METADATA,sha256=IpEKqXyonLzCCgGeJ_4xNgt5KaS9ZsoNMQ-ZpE9szTU,2410
|
| 4 |
+
wheel-0.46.3.dist-info/RECORD,,
|
| 5 |
+
wheel-0.46.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
wheel-0.46.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
| 7 |
+
wheel-0.46.3.dist-info/entry_points.txt,sha256=JJdtSAGTvMLbIkTVZUAMvGKO39FtWfCVF8mp_NH6e4g,110
|
| 8 |
+
wheel-0.46.3.dist-info/licenses/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107
|
| 9 |
+
wheel/__init__.py,sha256=UweKvhe4SyP7zFyDoYo8BOuwTA6q3-_WpMmY2NNO54c,59
|
| 10 |
+
wheel/__main__.py,sha256=_83wl9tyGU2cHiqfudpubGHdRL5uonPXnzeznznkxzs,512
|
| 11 |
+
wheel/_bdist_wheel.py,sha256=bpmNa7_s-CYFkVgXf9ENAYTiJ01XBhRW4pxH1T8XYsI,21729
|
| 12 |
+
wheel/_commands/__init__.py,sha256=fCRAQZNDyj2JLrufdgPsBlaRS_t_j_aBUMpXj09KZ4E,4432
|
| 13 |
+
wheel/_commands/convert.py,sha256=0wSJMU0m-6LY16Om8Wmmloy-hJWFZeOmI8hT-2Z7Qms,12743
|
| 14 |
+
wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078
|
| 15 |
+
wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775
|
| 16 |
+
wheel/_commands/unpack.py,sha256=AjDSS23XYyCSFfifnMutinrpPv-DK_2wbNHkKAUFwgM,1016
|
| 17 |
+
wheel/_metadata.py,sha256=BP5jC9uC1hyicp7nL4FJ2LYixNFpEJIV_uMDY1KBZBg,6188
|
| 18 |
+
wheel/_setuptools_logging.py,sha256=-5KC-lne0ilOUWIDfOkqapUWGMFZhuKYDIavIZiB5kM,781
|
| 19 |
+
wheel/bdist_wheel.py,sha256=HrzYiSzMkh5ohAAhlQnYBS1p8qbr85X6F59xqxd9kBg,1102
|
| 20 |
+
wheel/macosx_libfile.py,sha256=pL0wm88jRMl_4ASgGlNg_mz69Zmv5xm8JSkjLdwyvIQ,16712
|
| 21 |
+
wheel/metadata.py,sha256=GknOO7JJiZMlcEe_fiD7nqnDTTLd0sX_-IgipM4L3-4,757
|
| 22 |
+
wheel/wheelfile.py,sha256=m_g_7TNsEp-j-xnvSr5yDLEFb1nhyObueq9Q5_1_lBA,8720
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/REQUESTED
ADDED
|
File without changes
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: flit 3.12.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
wheel=wheel._commands:main
|
| 3 |
+
|
| 4 |
+
[distutils.commands]
|
| 5 |
+
bdist_wheel=wheel.bdist_wheel:bdist_wheel
|
| 6 |
+
|
python/Lib/site-packages/setuptools/_vendor/wheel-0.46.3.dist-info/licenses/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012 Daniel Holth <dholth@fastmail.fm> and contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a
|
| 6 |
+
copy of this software and associated documentation files (the "Software"),
|
| 7 |
+
to deal in the Software without restriction, including without limitation
|
| 8 |
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 9 |
+
and/or sell copies of the Software, and to permit persons to whom the
|
| 10 |
+
Software is furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included
|
| 13 |
+
in all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 18 |
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
| 19 |
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
| 20 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 21 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
python/Lib/site-packages/setuptools/_vendor/wheel/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
__version__ = "0.46.3"
|
python/Lib/site-packages/setuptools/_vendor/wheel/__main__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Wheel command line tool (enables the ``python -m wheel`` syntax)
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import sys
|
| 8 |
+
from typing import NoReturn
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def main() -> NoReturn: # needed for console script
|
| 12 |
+
if __package__ == "":
|
| 13 |
+
# To be able to run 'python wheel-0.9.whl/wheel':
|
| 14 |
+
import os.path
|
| 15 |
+
|
| 16 |
+
path = os.path.dirname(os.path.dirname(__file__))
|
| 17 |
+
sys.path[0:0] = [path]
|
| 18 |
+
|
| 19 |
+
from ._commands import main as cli_main
|
| 20 |
+
|
| 21 |
+
sys.exit(cli_main())
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
main()
|
python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/bdist_wheel.cpython-313.pyc
ADDED
|
Binary file (772 Bytes). View file
|
|
|
python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/macosx_libfile.cpython-313.pyc
ADDED
|
Binary file (16.5 kB). View file
|
|
|
python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/metadata.cpython-313.pyc
ADDED
|
Binary file (846 Bytes). View file
|
|
|
python/Lib/site-packages/setuptools/_vendor/wheel/__pycache__/wheelfile.cpython-313.pyc
ADDED
|
Binary file (12.3 kB). View file
|
|
|
python/Lib/site-packages/setuptools/_vendor/wheel/_bdist_wheel.py
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Create a wheel (.whl) distribution.
|
| 3 |
+
|
| 4 |
+
A wheel is a built archive format.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import logging
|
| 10 |
+
import os
|
| 11 |
+
import re
|
| 12 |
+
import shutil
|
| 13 |
+
import stat
|
| 14 |
+
import struct
|
| 15 |
+
import sys
|
| 16 |
+
import sysconfig
|
| 17 |
+
import warnings
|
| 18 |
+
from collections.abc import Iterable, Sequence
|
| 19 |
+
from email.generator import BytesGenerator, Generator
|
| 20 |
+
from email.policy import EmailPolicy
|
| 21 |
+
from glob import iglob
|
| 22 |
+
from shutil import rmtree
|
| 23 |
+
from typing import TYPE_CHECKING, Callable, Literal, cast
|
| 24 |
+
from zipfile import ZIP_DEFLATED, ZIP_STORED
|
| 25 |
+
|
| 26 |
+
import setuptools
|
| 27 |
+
from packaging import tags
|
| 28 |
+
from packaging import version as _packaging_version
|
| 29 |
+
from setuptools import Command
|
| 30 |
+
|
| 31 |
+
from . import __version__ as wheel_version
|
| 32 |
+
from ._metadata import pkginfo_to_metadata
|
| 33 |
+
from .wheelfile import WheelFile
|
| 34 |
+
|
| 35 |
+
if TYPE_CHECKING:
|
| 36 |
+
import types
|
| 37 |
+
|
| 38 |
+
# ensure Python logging is configured
|
| 39 |
+
try:
|
| 40 |
+
__import__("setuptools.logging")
|
| 41 |
+
except ImportError:
|
| 42 |
+
# setuptools < ??
|
| 43 |
+
from . import _setuptools_logging
|
| 44 |
+
|
| 45 |
+
_setuptools_logging.configure()
|
| 46 |
+
|
| 47 |
+
log = logging.getLogger("wheel")
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def safe_name(name: str) -> str:
|
| 51 |
+
"""Convert an arbitrary string to a standard distribution name
|
| 52 |
+
Any runs of non-alphanumeric/. characters are replaced with a single '-'.
|
| 53 |
+
"""
|
| 54 |
+
return re.sub("[^A-Za-z0-9.]+", "-", name)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def safe_version(version: str) -> str:
|
| 58 |
+
"""
|
| 59 |
+
Convert an arbitrary string to a standard version string
|
| 60 |
+
"""
|
| 61 |
+
try:
|
| 62 |
+
# normalize the version
|
| 63 |
+
return str(_packaging_version.Version(version))
|
| 64 |
+
except _packaging_version.InvalidVersion:
|
| 65 |
+
version = version.replace(" ", ".")
|
| 66 |
+
return re.sub("[^A-Za-z0-9.]+", "-", version)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
setuptools_major_version = int(setuptools.__version__.split(".")[0])
|
| 70 |
+
|
| 71 |
+
PY_LIMITED_API_PATTERN = r"cp3\d"
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def _is_32bit_interpreter() -> bool:
|
| 75 |
+
return struct.calcsize("P") == 4
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def python_tag() -> str:
|
| 79 |
+
return f"py{sys.version_info[0]}"
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def get_platform(archive_root: str | None) -> str:
|
| 83 |
+
"""Return our platform name 'win32', 'linux_x86_64'"""
|
| 84 |
+
result = sysconfig.get_platform()
|
| 85 |
+
if result.startswith("macosx") and archive_root is not None:
|
| 86 |
+
from .macosx_libfile import calculate_macosx_platform_tag
|
| 87 |
+
|
| 88 |
+
result = calculate_macosx_platform_tag(archive_root, result)
|
| 89 |
+
elif _is_32bit_interpreter():
|
| 90 |
+
if result == "linux-x86_64":
|
| 91 |
+
# pip pull request #3497
|
| 92 |
+
result = "linux-i686"
|
| 93 |
+
elif result == "linux-aarch64":
|
| 94 |
+
# packaging pull request #234
|
| 95 |
+
# TODO armv8l, packaging pull request #690 => this did not land
|
| 96 |
+
# in pip/packaging yet
|
| 97 |
+
result = "linux-armv7l"
|
| 98 |
+
|
| 99 |
+
return result.replace("-", "_")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def get_flag(
|
| 103 |
+
var: str, fallback: bool, expected: bool = True, warn: bool = True
|
| 104 |
+
) -> bool:
|
| 105 |
+
"""Use a fallback value for determining SOABI flags if the needed config
|
| 106 |
+
var is unset or unavailable."""
|
| 107 |
+
val = sysconfig.get_config_var(var)
|
| 108 |
+
if val is None:
|
| 109 |
+
if warn:
|
| 110 |
+
warnings.warn(
|
| 111 |
+
f"Config variable '{var}' is unset, Python ABI tag may be incorrect",
|
| 112 |
+
RuntimeWarning,
|
| 113 |
+
stacklevel=2,
|
| 114 |
+
)
|
| 115 |
+
return fallback
|
| 116 |
+
return val == expected
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def get_abi_tag() -> str | None:
|
| 120 |
+
"""Return the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2)."""
|
| 121 |
+
soabi: str = sysconfig.get_config_var("SOABI")
|
| 122 |
+
impl = tags.interpreter_name()
|
| 123 |
+
if not soabi and impl in ("cp", "pp") and hasattr(sys, "maxunicode"):
|
| 124 |
+
d = ""
|
| 125 |
+
m = ""
|
| 126 |
+
u = ""
|
| 127 |
+
if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")):
|
| 128 |
+
d = "d"
|
| 129 |
+
|
| 130 |
+
if get_flag(
|
| 131 |
+
"WITH_PYMALLOC",
|
| 132 |
+
impl == "cp",
|
| 133 |
+
warn=(impl == "cp" and sys.version_info < (3, 8)),
|
| 134 |
+
) and sys.version_info < (3, 8):
|
| 135 |
+
m = "m"
|
| 136 |
+
|
| 137 |
+
abi = f"{impl}{tags.interpreter_version()}{d}{m}{u}"
|
| 138 |
+
elif soabi and impl == "cp" and soabi.startswith("cpython"):
|
| 139 |
+
# non-Windows
|
| 140 |
+
abi = "cp" + soabi.split("-")[1]
|
| 141 |
+
elif soabi and impl == "cp" and soabi.startswith("cp"):
|
| 142 |
+
# Windows
|
| 143 |
+
abi = soabi.split("-")[0]
|
| 144 |
+
elif soabi and impl == "pp":
|
| 145 |
+
# we want something like pypy36-pp73
|
| 146 |
+
abi = "-".join(soabi.split("-")[:2])
|
| 147 |
+
abi = abi.replace(".", "_").replace("-", "_")
|
| 148 |
+
elif soabi and impl == "graalpy":
|
| 149 |
+
abi = "-".join(soabi.split("-")[:3])
|
| 150 |
+
abi = abi.replace(".", "_").replace("-", "_")
|
| 151 |
+
elif soabi:
|
| 152 |
+
abi = soabi.replace(".", "_").replace("-", "_")
|
| 153 |
+
else:
|
| 154 |
+
abi = None
|
| 155 |
+
|
| 156 |
+
return abi
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def safer_name(name: str) -> str:
|
| 160 |
+
return safe_name(name).replace("-", "_")
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def safer_version(version: str) -> str:
|
| 164 |
+
return safe_version(version).replace("-", "_")
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def remove_readonly(
|
| 168 |
+
func: Callable[..., object],
|
| 169 |
+
path: str,
|
| 170 |
+
excinfo: tuple[type[Exception], Exception, types.TracebackType],
|
| 171 |
+
) -> None:
|
| 172 |
+
remove_readonly_exc(func, path, excinfo[1])
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
def remove_readonly_exc(func: Callable[..., object], path: str, exc: Exception) -> None:
|
| 176 |
+
os.chmod(path, stat.S_IWRITE)
|
| 177 |
+
func(path)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
class bdist_wheel(Command):
|
| 181 |
+
description = "create a wheel distribution"
|
| 182 |
+
|
| 183 |
+
supported_compressions = {
|
| 184 |
+
"stored": ZIP_STORED,
|
| 185 |
+
"deflated": ZIP_DEFLATED,
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
user_options = [
|
| 189 |
+
("bdist-dir=", "b", "temporary directory for creating the distribution"),
|
| 190 |
+
(
|
| 191 |
+
"plat-name=",
|
| 192 |
+
"p",
|
| 193 |
+
"platform name to embed in generated filenames "
|
| 194 |
+
f"(default: {get_platform(None)})",
|
| 195 |
+
),
|
| 196 |
+
(
|
| 197 |
+
"keep-temp",
|
| 198 |
+
"k",
|
| 199 |
+
"keep the pseudo-installation tree around after "
|
| 200 |
+
"creating the distribution archive",
|
| 201 |
+
),
|
| 202 |
+
("dist-dir=", "d", "directory to put final built distributions in"),
|
| 203 |
+
("skip-build", None, "skip rebuilding everything (for testing/debugging)"),
|
| 204 |
+
(
|
| 205 |
+
"relative",
|
| 206 |
+
None,
|
| 207 |
+
"build the archive using relative paths (default: false)",
|
| 208 |
+
),
|
| 209 |
+
(
|
| 210 |
+
"owner=",
|
| 211 |
+
"u",
|
| 212 |
+
"Owner name used when creating a tar file [default: current user]",
|
| 213 |
+
),
|
| 214 |
+
(
|
| 215 |
+
"group=",
|
| 216 |
+
"g",
|
| 217 |
+
"Group name used when creating a tar file [default: current group]",
|
| 218 |
+
),
|
| 219 |
+
("universal", None, "make a universal wheel (default: false)"),
|
| 220 |
+
(
|
| 221 |
+
"compression=",
|
| 222 |
+
None,
|
| 223 |
+
"zipfile compression (one of: {}) (default: 'deflated')".format(
|
| 224 |
+
", ".join(supported_compressions)
|
| 225 |
+
),
|
| 226 |
+
),
|
| 227 |
+
(
|
| 228 |
+
"python-tag=",
|
| 229 |
+
None,
|
| 230 |
+
f"Python implementation compatibility tag (default: '{python_tag()}')",
|
| 231 |
+
),
|
| 232 |
+
(
|
| 233 |
+
"build-number=",
|
| 234 |
+
None,
|
| 235 |
+
"Build number for this particular version. "
|
| 236 |
+
"As specified in PEP-0427, this must start with a digit. "
|
| 237 |
+
"[default: None]",
|
| 238 |
+
),
|
| 239 |
+
(
|
| 240 |
+
"py-limited-api=",
|
| 241 |
+
None,
|
| 242 |
+
"Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)",
|
| 243 |
+
),
|
| 244 |
+
]
|
| 245 |
+
|
| 246 |
+
boolean_options = ["keep-temp", "skip-build", "relative", "universal"]
|
| 247 |
+
|
| 248 |
+
def initialize_options(self):
|
| 249 |
+
self.bdist_dir: str = None
|
| 250 |
+
self.data_dir = None
|
| 251 |
+
self.plat_name: str | None = None
|
| 252 |
+
self.plat_tag = None
|
| 253 |
+
self.format = "zip"
|
| 254 |
+
self.keep_temp = False
|
| 255 |
+
self.dist_dir: str | None = None
|
| 256 |
+
self.egginfo_dir = None
|
| 257 |
+
self.root_is_pure: bool | None = None
|
| 258 |
+
self.skip_build = None
|
| 259 |
+
self.relative = False
|
| 260 |
+
self.owner = None
|
| 261 |
+
self.group = None
|
| 262 |
+
self.universal: bool = False
|
| 263 |
+
self.compression: str | int = "deflated"
|
| 264 |
+
self.python_tag: str = python_tag()
|
| 265 |
+
self.build_number: str | None = None
|
| 266 |
+
self.py_limited_api: str | Literal[False] = False
|
| 267 |
+
self.plat_name_supplied = False
|
| 268 |
+
|
| 269 |
+
def finalize_options(self):
|
| 270 |
+
if self.bdist_dir is None:
|
| 271 |
+
bdist_base = self.get_finalized_command("bdist").bdist_base
|
| 272 |
+
self.bdist_dir = os.path.join(bdist_base, "wheel")
|
| 273 |
+
|
| 274 |
+
egg_info = self.distribution.get_command_obj("egg_info")
|
| 275 |
+
egg_info.ensure_finalized() # needed for correct `wheel_dist_name`
|
| 276 |
+
|
| 277 |
+
self.data_dir = self.wheel_dist_name + ".data"
|
| 278 |
+
self.plat_name_supplied = self.plat_name is not None
|
| 279 |
+
|
| 280 |
+
try:
|
| 281 |
+
self.compression = self.supported_compressions[self.compression]
|
| 282 |
+
except KeyError:
|
| 283 |
+
raise ValueError(f"Unsupported compression: {self.compression}") from None
|
| 284 |
+
|
| 285 |
+
need_options = ("dist_dir", "plat_name", "skip_build")
|
| 286 |
+
|
| 287 |
+
self.set_undefined_options("bdist", *zip(need_options, need_options))
|
| 288 |
+
|
| 289 |
+
self.root_is_pure = not (
|
| 290 |
+
self.distribution.has_ext_modules() or self.distribution.has_c_libraries()
|
| 291 |
+
)
|
| 292 |
+
|
| 293 |
+
if self.py_limited_api and not re.match(
|
| 294 |
+
PY_LIMITED_API_PATTERN, self.py_limited_api
|
| 295 |
+
):
|
| 296 |
+
raise ValueError(f"py-limited-api must match '{PY_LIMITED_API_PATTERN}'")
|
| 297 |
+
|
| 298 |
+
# Support legacy [wheel] section for setting universal
|
| 299 |
+
wheel = self.distribution.get_option_dict("wheel")
|
| 300 |
+
if "universal" in wheel:
|
| 301 |
+
# please don't define this in your global configs
|
| 302 |
+
log.warning(
|
| 303 |
+
"The [wheel] section is deprecated. Use [bdist_wheel] instead.",
|
| 304 |
+
)
|
| 305 |
+
val = wheel["universal"][1].strip()
|
| 306 |
+
if val.lower() in ("1", "true", "yes"):
|
| 307 |
+
self.universal = True
|
| 308 |
+
|
| 309 |
+
if self.build_number is not None and not self.build_number[:1].isdigit():
|
| 310 |
+
raise ValueError("Build tag (build-number) must start with a digit.")
|
| 311 |
+
|
| 312 |
+
@property
|
| 313 |
+
def wheel_dist_name(self):
|
| 314 |
+
"""Return distribution full name with - replaced with _"""
|
| 315 |
+
components = (
|
| 316 |
+
safer_name(self.distribution.get_name()),
|
| 317 |
+
safer_version(self.distribution.get_version()),
|
| 318 |
+
)
|
| 319 |
+
if self.build_number:
|
| 320 |
+
components += (self.build_number,)
|
| 321 |
+
return "-".join(components)
|
| 322 |
+
|
| 323 |
+
def get_tag(self) -> tuple[str, str, str]:
|
| 324 |
+
# bdist sets self.plat_name if unset, we should only use it for purepy
|
| 325 |
+
# wheels if the user supplied it.
|
| 326 |
+
if self.plat_name_supplied:
|
| 327 |
+
plat_name = cast(str, self.plat_name)
|
| 328 |
+
elif self.root_is_pure:
|
| 329 |
+
plat_name = "any"
|
| 330 |
+
else:
|
| 331 |
+
# macosx contains system version in platform name so need special handle
|
| 332 |
+
if self.plat_name and not self.plat_name.startswith("macosx"):
|
| 333 |
+
plat_name = self.plat_name
|
| 334 |
+
else:
|
| 335 |
+
# on macosx always limit the platform name to comply with any
|
| 336 |
+
# c-extension modules in bdist_dir, since the user can specify
|
| 337 |
+
# a higher MACOSX_DEPLOYMENT_TARGET via tools like CMake
|
| 338 |
+
|
| 339 |
+
# on other platforms, and on macosx if there are no c-extension
|
| 340 |
+
# modules, use the default platform name.
|
| 341 |
+
plat_name = get_platform(self.bdist_dir)
|
| 342 |
+
|
| 343 |
+
if _is_32bit_interpreter():
|
| 344 |
+
if plat_name in ("linux-x86_64", "linux_x86_64"):
|
| 345 |
+
plat_name = "linux_i686"
|
| 346 |
+
if plat_name in ("linux-aarch64", "linux_aarch64"):
|
| 347 |
+
# TODO armv8l, packaging pull request #690 => this did not land
|
| 348 |
+
# in pip/packaging yet
|
| 349 |
+
plat_name = "linux_armv7l"
|
| 350 |
+
|
| 351 |
+
plat_name = (
|
| 352 |
+
plat_name.lower().replace("-", "_").replace(".", "_").replace(" ", "_")
|
| 353 |
+
)
|
| 354 |
+
|
| 355 |
+
if self.root_is_pure:
|
| 356 |
+
if self.universal:
|
| 357 |
+
impl = "py2.py3"
|
| 358 |
+
else:
|
| 359 |
+
impl = self.python_tag
|
| 360 |
+
tag = (impl, "none", plat_name)
|
| 361 |
+
else:
|
| 362 |
+
impl_name = tags.interpreter_name()
|
| 363 |
+
impl_ver = tags.interpreter_version()
|
| 364 |
+
impl = impl_name + impl_ver
|
| 365 |
+
# We don't work on CPython 3.1, 3.0.
|
| 366 |
+
if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
|
| 367 |
+
impl = self.py_limited_api
|
| 368 |
+
abi_tag = "abi3"
|
| 369 |
+
else:
|
| 370 |
+
abi_tag = str(get_abi_tag()).lower()
|
| 371 |
+
tag = (impl, abi_tag, plat_name)
|
| 372 |
+
# issue gh-374: allow overriding plat_name
|
| 373 |
+
supported_tags = [
|
| 374 |
+
(t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
|
| 375 |
+
]
|
| 376 |
+
assert tag in supported_tags, (
|
| 377 |
+
f"would build wheel with unsupported tag {tag}"
|
| 378 |
+
)
|
| 379 |
+
return tag
|
| 380 |
+
|
| 381 |
+
def run(self):
|
| 382 |
+
build_scripts = self.reinitialize_command("build_scripts")
|
| 383 |
+
build_scripts.executable = "python"
|
| 384 |
+
build_scripts.force = True
|
| 385 |
+
|
| 386 |
+
build_ext = self.reinitialize_command("build_ext")
|
| 387 |
+
build_ext.inplace = False
|
| 388 |
+
|
| 389 |
+
if not self.skip_build:
|
| 390 |
+
self.run_command("build")
|
| 391 |
+
|
| 392 |
+
install = self.reinitialize_command("install", reinit_subcommands=True)
|
| 393 |
+
install.root = self.bdist_dir
|
| 394 |
+
install.compile = False
|
| 395 |
+
install.skip_build = self.skip_build
|
| 396 |
+
install.warn_dir = False
|
| 397 |
+
|
| 398 |
+
# A wheel without setuptools scripts is more cross-platform.
|
| 399 |
+
# Use the (undocumented) `no_ep` option to setuptools'
|
| 400 |
+
# install_scripts command to avoid creating entry point scripts.
|
| 401 |
+
install_scripts = self.reinitialize_command("install_scripts")
|
| 402 |
+
install_scripts.no_ep = True
|
| 403 |
+
|
| 404 |
+
# Use a custom scheme for the archive, because we have to decide
|
| 405 |
+
# at installation time which scheme to use.
|
| 406 |
+
for key in ("headers", "scripts", "data", "purelib", "platlib"):
|
| 407 |
+
setattr(install, "install_" + key, os.path.join(self.data_dir, key))
|
| 408 |
+
|
| 409 |
+
basedir_observed = ""
|
| 410 |
+
|
| 411 |
+
if os.name == "nt":
|
| 412 |
+
# win32 barfs if any of these are ''; could be '.'?
|
| 413 |
+
# (distutils.command.install:change_roots bug)
|
| 414 |
+
basedir_observed = os.path.normpath(os.path.join(self.data_dir, ".."))
|
| 415 |
+
self.install_libbase = self.install_lib = basedir_observed
|
| 416 |
+
|
| 417 |
+
setattr(
|
| 418 |
+
install,
|
| 419 |
+
"install_purelib" if self.root_is_pure else "install_platlib",
|
| 420 |
+
basedir_observed,
|
| 421 |
+
)
|
| 422 |
+
|
| 423 |
+
log.info(f"installing to {self.bdist_dir}")
|
| 424 |
+
|
| 425 |
+
self.run_command("install")
|
| 426 |
+
|
| 427 |
+
impl_tag, abi_tag, plat_tag = self.get_tag()
|
| 428 |
+
archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}"
|
| 429 |
+
if not self.relative:
|
| 430 |
+
archive_root = self.bdist_dir
|
| 431 |
+
else:
|
| 432 |
+
archive_root = os.path.join(
|
| 433 |
+
self.bdist_dir, self._ensure_relative(install.install_base)
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
self.set_undefined_options("install_egg_info", ("target", "egginfo_dir"))
|
| 437 |
+
distinfo_dirname = (
|
| 438 |
+
f"{safer_name(self.distribution.get_name())}-"
|
| 439 |
+
f"{safer_version(self.distribution.get_version())}.dist-info"
|
| 440 |
+
)
|
| 441 |
+
distinfo_dir = os.path.join(self.bdist_dir, distinfo_dirname)
|
| 442 |
+
self.egg2dist(self.egginfo_dir, distinfo_dir)
|
| 443 |
+
|
| 444 |
+
self.write_wheelfile(distinfo_dir)
|
| 445 |
+
|
| 446 |
+
# Make the archive
|
| 447 |
+
if not os.path.exists(self.dist_dir):
|
| 448 |
+
os.makedirs(self.dist_dir)
|
| 449 |
+
|
| 450 |
+
wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
|
| 451 |
+
with WheelFile(wheel_path, "w", self.compression) as wf:
|
| 452 |
+
wf.write_files(archive_root)
|
| 453 |
+
|
| 454 |
+
# Add to 'Distribution.dist_files' so that the "upload" command works
|
| 455 |
+
getattr(self.distribution, "dist_files", []).append(
|
| 456 |
+
(
|
| 457 |
+
"bdist_wheel",
|
| 458 |
+
"{}.{}".format(*sys.version_info[:2]), # like 3.7
|
| 459 |
+
wheel_path,
|
| 460 |
+
)
|
| 461 |
+
)
|
| 462 |
+
|
| 463 |
+
if not self.keep_temp:
|
| 464 |
+
log.info(f"removing {self.bdist_dir}")
|
| 465 |
+
if not self.dry_run:
|
| 466 |
+
if sys.version_info < (3, 12):
|
| 467 |
+
rmtree(self.bdist_dir, onerror=remove_readonly)
|
| 468 |
+
else:
|
| 469 |
+
rmtree(self.bdist_dir, onexc=remove_readonly_exc)
|
| 470 |
+
|
| 471 |
+
def write_wheelfile(
|
| 472 |
+
self, wheelfile_base: str, generator: str = f"bdist_wheel ({wheel_version})"
|
| 473 |
+
):
|
| 474 |
+
from email.message import Message
|
| 475 |
+
|
| 476 |
+
msg = Message()
|
| 477 |
+
msg["Wheel-Version"] = "1.0" # of the spec
|
| 478 |
+
msg["Generator"] = generator
|
| 479 |
+
msg["Root-Is-Purelib"] = str(self.root_is_pure).lower()
|
| 480 |
+
if self.build_number is not None:
|
| 481 |
+
msg["Build"] = self.build_number
|
| 482 |
+
|
| 483 |
+
# Doesn't work for bdist_wininst
|
| 484 |
+
impl_tag, abi_tag, plat_tag = self.get_tag()
|
| 485 |
+
for impl in impl_tag.split("."):
|
| 486 |
+
for abi in abi_tag.split("."):
|
| 487 |
+
for plat in plat_tag.split("."):
|
| 488 |
+
msg["Tag"] = "-".join((impl, abi, plat))
|
| 489 |
+
|
| 490 |
+
wheelfile_path = os.path.join(wheelfile_base, "WHEEL")
|
| 491 |
+
log.info(f"creating {wheelfile_path}")
|
| 492 |
+
with open(wheelfile_path, "wb") as f:
|
| 493 |
+
BytesGenerator(f, maxheaderlen=0).flatten(msg)
|
| 494 |
+
|
| 495 |
+
def _ensure_relative(self, path: str) -> str:
|
| 496 |
+
# copied from dir_util, deleted
|
| 497 |
+
drive, path = os.path.splitdrive(path)
|
| 498 |
+
if path[0:1] == os.sep:
|
| 499 |
+
path = drive + path[1:]
|
| 500 |
+
return path
|
| 501 |
+
|
| 502 |
+
@property
|
| 503 |
+
def license_paths(self) -> Iterable[str]:
|
| 504 |
+
if setuptools_major_version >= 57:
|
| 505 |
+
# Setuptools has resolved any patterns to actual file names
|
| 506 |
+
return self.distribution.metadata.license_files or ()
|
| 507 |
+
|
| 508 |
+
files: set[str] = set()
|
| 509 |
+
metadata = self.distribution.get_option_dict("metadata")
|
| 510 |
+
if setuptools_major_version >= 42:
|
| 511 |
+
# Setuptools recognizes the license_files option but does not do globbing
|
| 512 |
+
patterns = cast(Sequence[str], self.distribution.metadata.license_files)
|
| 513 |
+
else:
|
| 514 |
+
# Prior to those, wheel is entirely responsible for handling license files
|
| 515 |
+
if "license_files" in metadata:
|
| 516 |
+
patterns = metadata["license_files"][1].split()
|
| 517 |
+
else:
|
| 518 |
+
patterns = ()
|
| 519 |
+
|
| 520 |
+
if "license_file" in metadata:
|
| 521 |
+
warnings.warn(
|
| 522 |
+
'The "license_file" option is deprecated. Use "license_files" instead.',
|
| 523 |
+
DeprecationWarning,
|
| 524 |
+
stacklevel=2,
|
| 525 |
+
)
|
| 526 |
+
files.add(metadata["license_file"][1])
|
| 527 |
+
|
| 528 |
+
if not files and not patterns and not isinstance(patterns, list):
|
| 529 |
+
patterns = ("LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*")
|
| 530 |
+
|
| 531 |
+
for pattern in patterns:
|
| 532 |
+
for path in iglob(pattern):
|
| 533 |
+
if path.endswith("~"):
|
| 534 |
+
log.debug(
|
| 535 |
+
f'ignoring license file "{path}" as it looks like a backup'
|
| 536 |
+
)
|
| 537 |
+
continue
|
| 538 |
+
|
| 539 |
+
if path not in files and os.path.isfile(path):
|
| 540 |
+
log.info(
|
| 541 |
+
f'adding license file "{path}" (matched pattern "{pattern}")'
|
| 542 |
+
)
|
| 543 |
+
files.add(path)
|
| 544 |
+
|
| 545 |
+
return files
|
| 546 |
+
|
| 547 |
+
def egg2dist(self, egginfo_path: str, distinfo_path: str):
|
| 548 |
+
"""Convert an .egg-info directory into a .dist-info directory"""
|
| 549 |
+
|
| 550 |
+
def adios(p: str) -> None:
|
| 551 |
+
"""Appropriately delete directory, file or link."""
|
| 552 |
+
if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p):
|
| 553 |
+
shutil.rmtree(p)
|
| 554 |
+
elif os.path.exists(p):
|
| 555 |
+
os.unlink(p)
|
| 556 |
+
|
| 557 |
+
adios(distinfo_path)
|
| 558 |
+
|
| 559 |
+
if not os.path.exists(egginfo_path):
|
| 560 |
+
# There is no egg-info. This is probably because the egg-info
|
| 561 |
+
# file/directory is not named matching the distribution name used
|
| 562 |
+
# to name the archive file. Check for this case and report
|
| 563 |
+
# accordingly.
|
| 564 |
+
import glob
|
| 565 |
+
|
| 566 |
+
pat = os.path.join(os.path.dirname(egginfo_path), "*.egg-info")
|
| 567 |
+
possible = glob.glob(pat)
|
| 568 |
+
err = f"Egg metadata expected at {egginfo_path} but not found"
|
| 569 |
+
if possible:
|
| 570 |
+
alt = os.path.basename(possible[0])
|
| 571 |
+
err += f" ({alt} found - possible misnamed archive file?)"
|
| 572 |
+
|
| 573 |
+
raise ValueError(err)
|
| 574 |
+
|
| 575 |
+
if os.path.isfile(egginfo_path):
|
| 576 |
+
# .egg-info is a single file
|
| 577 |
+
pkg_info = pkginfo_to_metadata(egginfo_path, egginfo_path)
|
| 578 |
+
os.mkdir(distinfo_path)
|
| 579 |
+
else:
|
| 580 |
+
# .egg-info is a directory
|
| 581 |
+
pkginfo_path = os.path.join(egginfo_path, "PKG-INFO")
|
| 582 |
+
pkg_info = pkginfo_to_metadata(egginfo_path, pkginfo_path)
|
| 583 |
+
|
| 584 |
+
# ignore common egg metadata that is useless to wheel
|
| 585 |
+
shutil.copytree(
|
| 586 |
+
egginfo_path,
|
| 587 |
+
distinfo_path,
|
| 588 |
+
ignore=lambda x, y: {
|
| 589 |
+
"PKG-INFO",
|
| 590 |
+
"requires.txt",
|
| 591 |
+
"SOURCES.txt",
|
| 592 |
+
"not-zip-safe",
|
| 593 |
+
},
|
| 594 |
+
)
|
| 595 |
+
|
| 596 |
+
# delete dependency_links if it is only whitespace
|
| 597 |
+
dependency_links_path = os.path.join(distinfo_path, "dependency_links.txt")
|
| 598 |
+
with open(dependency_links_path, encoding="utf-8") as dependency_links_file:
|
| 599 |
+
dependency_links = dependency_links_file.read().strip()
|
| 600 |
+
if not dependency_links:
|
| 601 |
+
adios(dependency_links_path)
|
| 602 |
+
|
| 603 |
+
pkg_info_path = os.path.join(distinfo_path, "METADATA")
|
| 604 |
+
serialization_policy = EmailPolicy(
|
| 605 |
+
utf8=True,
|
| 606 |
+
mangle_from_=False,
|
| 607 |
+
max_line_length=0,
|
| 608 |
+
)
|
| 609 |
+
with open(pkg_info_path, "w", encoding="utf-8") as out:
|
| 610 |
+
Generator(out, policy=serialization_policy).flatten(pkg_info)
|
| 611 |
+
|
| 612 |
+
for license_path in self.license_paths:
|
| 613 |
+
filename = os.path.basename(license_path)
|
| 614 |
+
shutil.copy(license_path, os.path.join(distinfo_path, filename))
|
| 615 |
+
|
| 616 |
+
adios(egginfo_path)
|
python/Lib/site-packages/setuptools/_vendor/wheel/_commands/convert.py
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os.path
|
| 4 |
+
import re
|
| 5 |
+
from abc import ABCMeta, abstractmethod
|
| 6 |
+
from collections import defaultdict
|
| 7 |
+
from collections.abc import Iterator
|
| 8 |
+
from email.message import Message
|
| 9 |
+
from email.parser import Parser
|
| 10 |
+
from email.policy import EmailPolicy
|
| 11 |
+
from glob import iglob
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
from textwrap import dedent
|
| 14 |
+
from zipfile import ZipFile
|
| 15 |
+
|
| 16 |
+
from packaging.tags import parse_tag
|
| 17 |
+
|
| 18 |
+
from .. import __version__
|
| 19 |
+
from .._metadata import generate_requirements
|
| 20 |
+
from ..wheelfile import WheelFile
|
| 21 |
+
|
| 22 |
+
egg_filename_re = re.compile(
|
| 23 |
+
r"""
|
| 24 |
+
(?P<name>.+?)-(?P<ver>.+?)
|
| 25 |
+
(-(?P<pyver>py\d\.\d+)
|
| 26 |
+
(-(?P<arch>.+?))?
|
| 27 |
+
)?.egg$""",
|
| 28 |
+
re.VERBOSE,
|
| 29 |
+
)
|
| 30 |
+
egg_info_re = re.compile(
|
| 31 |
+
r"""
|
| 32 |
+
^(?P<name>.+?)-(?P<ver>.+?)
|
| 33 |
+
(-(?P<pyver>py\d\.\d+)
|
| 34 |
+
)?.egg-info/""",
|
| 35 |
+
re.VERBOSE,
|
| 36 |
+
)
|
| 37 |
+
wininst_re = re.compile(
|
| 38 |
+
r"\.(?P<platform>win32|win-amd64)(?:-(?P<pyver>py\d\.\d))?\.exe$"
|
| 39 |
+
)
|
| 40 |
+
pyd_re = re.compile(r"\.(?P<abi>[a-z0-9]+)-(?P<platform>win32|win_amd64)\.pyd$")
|
| 41 |
+
serialization_policy = EmailPolicy(
|
| 42 |
+
utf8=True,
|
| 43 |
+
mangle_from_=False,
|
| 44 |
+
max_line_length=0,
|
| 45 |
+
)
|
| 46 |
+
GENERATOR = f"wheel {__version__}"
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def convert_requires(requires: str, metadata: Message) -> None:
|
| 50 |
+
extra: str | None = None
|
| 51 |
+
requirements: dict[str | None, list[str]] = defaultdict(list)
|
| 52 |
+
for line in requires.splitlines():
|
| 53 |
+
line = line.strip()
|
| 54 |
+
if not line:
|
| 55 |
+
continue
|
| 56 |
+
|
| 57 |
+
if line.startswith("[") and line.endswith("]"):
|
| 58 |
+
extra = line[1:-1]
|
| 59 |
+
continue
|
| 60 |
+
|
| 61 |
+
requirements[extra].append(line)
|
| 62 |
+
|
| 63 |
+
for key, value in generate_requirements(requirements):
|
| 64 |
+
metadata.add_header(key, value)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def convert_pkg_info(pkginfo: str, metadata: Message) -> None:
|
| 68 |
+
parsed_message = Parser().parsestr(pkginfo)
|
| 69 |
+
for key, value in parsed_message.items():
|
| 70 |
+
key_lower = key.lower()
|
| 71 |
+
if value == "UNKNOWN":
|
| 72 |
+
continue
|
| 73 |
+
|
| 74 |
+
if key_lower == "description":
|
| 75 |
+
description_lines = value.splitlines()
|
| 76 |
+
if description_lines:
|
| 77 |
+
value = "\n".join(
|
| 78 |
+
(
|
| 79 |
+
description_lines[0].lstrip(),
|
| 80 |
+
dedent("\n".join(description_lines[1:])),
|
| 81 |
+
"\n",
|
| 82 |
+
)
|
| 83 |
+
)
|
| 84 |
+
else:
|
| 85 |
+
value = "\n"
|
| 86 |
+
|
| 87 |
+
metadata.set_payload(value)
|
| 88 |
+
elif key_lower == "home-page":
|
| 89 |
+
metadata.add_header("Project-URL", f"Homepage, {value}")
|
| 90 |
+
elif key_lower == "download-url":
|
| 91 |
+
metadata.add_header("Project-URL", f"Download, {value}")
|
| 92 |
+
else:
|
| 93 |
+
metadata.add_header(key, value)
|
| 94 |
+
|
| 95 |
+
metadata.replace_header("Metadata-Version", "2.4")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def normalize(name: str) -> str:
|
| 99 |
+
return re.sub(r"[-_.]+", "-", name).lower().replace("-", "_")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class ConvertSource(metaclass=ABCMeta):
|
| 103 |
+
name: str
|
| 104 |
+
version: str
|
| 105 |
+
pyver: str = "py2.py3"
|
| 106 |
+
abi: str = "none"
|
| 107 |
+
platform: str = "any"
|
| 108 |
+
metadata: Message
|
| 109 |
+
|
| 110 |
+
@property
|
| 111 |
+
def dist_info_dir(self) -> str:
|
| 112 |
+
return f"{self.name}-{self.version}.dist-info"
|
| 113 |
+
|
| 114 |
+
@abstractmethod
|
| 115 |
+
def generate_contents(self) -> Iterator[tuple[str, bytes]]:
|
| 116 |
+
pass
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class EggFileSource(ConvertSource):
|
| 120 |
+
def __init__(self, path: Path):
|
| 121 |
+
if not (match := egg_filename_re.match(path.name)):
|
| 122 |
+
raise ValueError(f"Invalid egg file name: {path.name}")
|
| 123 |
+
|
| 124 |
+
# Binary wheels are assumed to be for CPython
|
| 125 |
+
self.path = path
|
| 126 |
+
self.name = normalize(match.group("name"))
|
| 127 |
+
self.version = match.group("ver")
|
| 128 |
+
if pyver := match.group("pyver"):
|
| 129 |
+
self.pyver = pyver.replace(".", "")
|
| 130 |
+
if arch := match.group("arch"):
|
| 131 |
+
self.abi = self.pyver.replace("py", "cp")
|
| 132 |
+
self.platform = normalize(arch)
|
| 133 |
+
|
| 134 |
+
self.metadata = Message()
|
| 135 |
+
|
| 136 |
+
def generate_contents(self) -> Iterator[tuple[str, bytes]]:
|
| 137 |
+
with ZipFile(self.path, "r") as zip_file:
|
| 138 |
+
for filename in sorted(zip_file.namelist()):
|
| 139 |
+
# Skip pure directory entries
|
| 140 |
+
if filename.endswith("/"):
|
| 141 |
+
continue
|
| 142 |
+
|
| 143 |
+
# Handle files in the egg-info directory specially, selectively moving
|
| 144 |
+
# them to the dist-info directory while converting as needed
|
| 145 |
+
if filename.startswith("EGG-INFO/"):
|
| 146 |
+
if filename == "EGG-INFO/requires.txt":
|
| 147 |
+
requires = zip_file.read(filename).decode("utf-8")
|
| 148 |
+
convert_requires(requires, self.metadata)
|
| 149 |
+
elif filename == "EGG-INFO/PKG-INFO":
|
| 150 |
+
pkginfo = zip_file.read(filename).decode("utf-8")
|
| 151 |
+
convert_pkg_info(pkginfo, self.metadata)
|
| 152 |
+
elif filename == "EGG-INFO/entry_points.txt":
|
| 153 |
+
yield (
|
| 154 |
+
f"{self.dist_info_dir}/entry_points.txt",
|
| 155 |
+
zip_file.read(filename),
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
continue
|
| 159 |
+
|
| 160 |
+
# For any other file, just pass it through
|
| 161 |
+
yield filename, zip_file.read(filename)
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
class EggDirectorySource(EggFileSource):
|
| 165 |
+
def generate_contents(self) -> Iterator[tuple[str, bytes]]:
|
| 166 |
+
for dirpath, _, filenames in os.walk(self.path):
|
| 167 |
+
for filename in sorted(filenames):
|
| 168 |
+
path = Path(dirpath, filename)
|
| 169 |
+
if path.parent.name == "EGG-INFO":
|
| 170 |
+
if path.name == "requires.txt":
|
| 171 |
+
requires = path.read_text("utf-8")
|
| 172 |
+
convert_requires(requires, self.metadata)
|
| 173 |
+
elif path.name == "PKG-INFO":
|
| 174 |
+
pkginfo = path.read_text("utf-8")
|
| 175 |
+
convert_pkg_info(pkginfo, self.metadata)
|
| 176 |
+
if name := self.metadata.get("Name"):
|
| 177 |
+
self.name = normalize(name)
|
| 178 |
+
|
| 179 |
+
if version := self.metadata.get("Version"):
|
| 180 |
+
self.version = version
|
| 181 |
+
elif path.name == "entry_points.txt":
|
| 182 |
+
yield (
|
| 183 |
+
f"{self.dist_info_dir}/entry_points.txt",
|
| 184 |
+
path.read_bytes(),
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
continue
|
| 188 |
+
|
| 189 |
+
# For any other file, just pass it through
|
| 190 |
+
yield str(path.relative_to(self.path)), path.read_bytes()
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
class WininstFileSource(ConvertSource):
|
| 194 |
+
"""
|
| 195 |
+
Handles distributions created with ``bdist_wininst``.
|
| 196 |
+
|
| 197 |
+
The egginfo filename has the format::
|
| 198 |
+
|
| 199 |
+
name-ver(-pyver)(-arch).egg-info
|
| 200 |
+
|
| 201 |
+
The installer filename has the format::
|
| 202 |
+
|
| 203 |
+
name-ver.arch(-pyver).exe
|
| 204 |
+
|
| 205 |
+
Some things to note:
|
| 206 |
+
|
| 207 |
+
1. The installer filename is not definitive. An installer can be renamed
|
| 208 |
+
and work perfectly well as an installer. So more reliable data should
|
| 209 |
+
be used whenever possible.
|
| 210 |
+
2. The egg-info data should be preferred for the name and version, because
|
| 211 |
+
these come straight from the distutils metadata, and are mandatory.
|
| 212 |
+
3. The pyver from the egg-info data should be ignored, as it is
|
| 213 |
+
constructed from the version of Python used to build the installer,
|
| 214 |
+
which is irrelevant - the installer filename is correct here (even to
|
| 215 |
+
the point that when it's not there, any version is implied).
|
| 216 |
+
4. The architecture must be taken from the installer filename, as it is
|
| 217 |
+
not included in the egg-info data.
|
| 218 |
+
5. Architecture-neutral installers still have an architecture because the
|
| 219 |
+
installer format itself (being executable) is architecture-specific. We
|
| 220 |
+
should therefore ignore the architecture if the content is pure-python.
|
| 221 |
+
"""
|
| 222 |
+
|
| 223 |
+
def __init__(self, path: Path):
|
| 224 |
+
self.path = path
|
| 225 |
+
self.metadata = Message()
|
| 226 |
+
|
| 227 |
+
# Determine the initial architecture and Python version from the file name
|
| 228 |
+
# (if possible)
|
| 229 |
+
if match := wininst_re.search(path.name):
|
| 230 |
+
self.platform = normalize(match.group("platform"))
|
| 231 |
+
if pyver := match.group("pyver"):
|
| 232 |
+
self.pyver = pyver.replace(".", "")
|
| 233 |
+
|
| 234 |
+
# Look for an .egg-info directory and any .pyd files for more precise info
|
| 235 |
+
egg_info_found = pyd_found = False
|
| 236 |
+
with ZipFile(self.path) as zip_file:
|
| 237 |
+
for filename in zip_file.namelist():
|
| 238 |
+
prefix, filename = filename.split("/", 1)
|
| 239 |
+
if not egg_info_found and (match := egg_info_re.match(filename)):
|
| 240 |
+
egg_info_found = True
|
| 241 |
+
self.name = normalize(match.group("name"))
|
| 242 |
+
self.version = match.group("ver")
|
| 243 |
+
if pyver := match.group("pyver"):
|
| 244 |
+
self.pyver = pyver.replace(".", "")
|
| 245 |
+
elif not pyd_found and (match := pyd_re.search(filename)):
|
| 246 |
+
pyd_found = True
|
| 247 |
+
self.abi = match.group("abi")
|
| 248 |
+
self.platform = match.group("platform")
|
| 249 |
+
|
| 250 |
+
if egg_info_found and pyd_found:
|
| 251 |
+
break
|
| 252 |
+
|
| 253 |
+
def generate_contents(self) -> Iterator[tuple[str, bytes]]:
|
| 254 |
+
dist_info_dir = f"{self.name}-{self.version}.dist-info"
|
| 255 |
+
data_dir = f"{self.name}-{self.version}.data"
|
| 256 |
+
with ZipFile(self.path, "r") as zip_file:
|
| 257 |
+
for filename in sorted(zip_file.namelist()):
|
| 258 |
+
# Skip pure directory entries
|
| 259 |
+
if filename.endswith("/"):
|
| 260 |
+
continue
|
| 261 |
+
|
| 262 |
+
# Handle files in the egg-info directory specially, selectively moving
|
| 263 |
+
# them to the dist-info directory while converting as needed
|
| 264 |
+
prefix, target_filename = filename.split("/", 1)
|
| 265 |
+
if egg_info_re.search(target_filename):
|
| 266 |
+
basename = target_filename.rsplit("/", 1)[-1]
|
| 267 |
+
if basename == "requires.txt":
|
| 268 |
+
requires = zip_file.read(filename).decode("utf-8")
|
| 269 |
+
convert_requires(requires, self.metadata)
|
| 270 |
+
elif basename == "PKG-INFO":
|
| 271 |
+
pkginfo = zip_file.read(filename).decode("utf-8")
|
| 272 |
+
convert_pkg_info(pkginfo, self.metadata)
|
| 273 |
+
elif basename == "entry_points.txt":
|
| 274 |
+
yield (
|
| 275 |
+
f"{dist_info_dir}/entry_points.txt",
|
| 276 |
+
zip_file.read(filename),
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
continue
|
| 280 |
+
elif prefix == "SCRIPTS":
|
| 281 |
+
target_filename = f"{data_dir}/scripts/{target_filename}"
|
| 282 |
+
|
| 283 |
+
# For any other file, just pass it through
|
| 284 |
+
yield target_filename, zip_file.read(filename)
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def convert(files: list[str], dest_dir: str, verbose: bool) -> None:
|
| 288 |
+
for pat in files:
|
| 289 |
+
for archive in iglob(pat):
|
| 290 |
+
path = Path(archive)
|
| 291 |
+
if path.suffix == ".egg":
|
| 292 |
+
if path.is_dir():
|
| 293 |
+
source: ConvertSource = EggDirectorySource(path)
|
| 294 |
+
else:
|
| 295 |
+
source = EggFileSource(path)
|
| 296 |
+
else:
|
| 297 |
+
source = WininstFileSource(path)
|
| 298 |
+
|
| 299 |
+
if verbose:
|
| 300 |
+
print(f"{archive}...", flush=True, end="")
|
| 301 |
+
|
| 302 |
+
dest_path = Path(dest_dir) / (
|
| 303 |
+
f"{source.name}-{source.version}-{source.pyver}-{source.abi}"
|
| 304 |
+
f"-{source.platform}.whl"
|
| 305 |
+
)
|
| 306 |
+
with WheelFile(dest_path, "w") as wheelfile:
|
| 307 |
+
for name_or_zinfo, contents in source.generate_contents():
|
| 308 |
+
wheelfile.writestr(name_or_zinfo, contents)
|
| 309 |
+
|
| 310 |
+
# Write the METADATA file
|
| 311 |
+
wheelfile.writestr(
|
| 312 |
+
f"{source.dist_info_dir}/METADATA",
|
| 313 |
+
source.metadata.as_string(policy=serialization_policy).encode(
|
| 314 |
+
"utf-8"
|
| 315 |
+
),
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
# Write the WHEEL file
|
| 319 |
+
wheel_message = Message()
|
| 320 |
+
wheel_message.add_header("Wheel-Version", "1.0")
|
| 321 |
+
wheel_message.add_header("Generator", GENERATOR)
|
| 322 |
+
wheel_message.add_header(
|
| 323 |
+
"Root-Is-Purelib", str(source.platform == "any").lower()
|
| 324 |
+
)
|
| 325 |
+
tags = parse_tag(f"{source.pyver}-{source.abi}-{source.platform}")
|
| 326 |
+
for tag in sorted(tags, key=lambda tag: tag.interpreter):
|
| 327 |
+
wheel_message.add_header("Tag", str(tag))
|
| 328 |
+
|
| 329 |
+
wheelfile.writestr(
|
| 330 |
+
f"{source.dist_info_dir}/WHEEL",
|
| 331 |
+
wheel_message.as_string(policy=serialization_policy).encode(
|
| 332 |
+
"utf-8"
|
| 333 |
+
),
|
| 334 |
+
)
|
| 335 |
+
|
| 336 |
+
if verbose:
|
| 337 |
+
print("OK")
|
python/Lib/site-packages/setuptools/_vendor/wheel/_commands/pack.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import email.policy
|
| 4 |
+
import os.path
|
| 5 |
+
import re
|
| 6 |
+
from email.generator import BytesGenerator
|
| 7 |
+
from email.parser import BytesParser
|
| 8 |
+
|
| 9 |
+
from ..wheelfile import WheelError, WheelFile
|
| 10 |
+
|
| 11 |
+
DIST_INFO_RE = re.compile(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))\.dist-info$")
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def pack(directory: str, dest_dir: str, build_number: str | None) -> None:
|
| 15 |
+
"""Repack a previously unpacked wheel directory into a new wheel file.
|
| 16 |
+
|
| 17 |
+
The .dist-info/WHEEL file must contain one or more tags so that the target
|
| 18 |
+
wheel file name can be determined.
|
| 19 |
+
|
| 20 |
+
:param directory: The unpacked wheel directory
|
| 21 |
+
:param dest_dir: Destination directory (defaults to the current directory)
|
| 22 |
+
"""
|
| 23 |
+
# Find the .dist-info directory
|
| 24 |
+
dist_info_dirs = [
|
| 25 |
+
fn
|
| 26 |
+
for fn in os.listdir(directory)
|
| 27 |
+
if os.path.isdir(os.path.join(directory, fn)) and DIST_INFO_RE.match(fn)
|
| 28 |
+
]
|
| 29 |
+
if len(dist_info_dirs) > 1:
|
| 30 |
+
raise WheelError(f"Multiple .dist-info directories found in {directory}")
|
| 31 |
+
elif not dist_info_dirs:
|
| 32 |
+
raise WheelError(f"No .dist-info directories found in {directory}")
|
| 33 |
+
|
| 34 |
+
# Determine the target wheel filename
|
| 35 |
+
dist_info_dir = dist_info_dirs[0]
|
| 36 |
+
name_version = DIST_INFO_RE.match(dist_info_dir).group("namever")
|
| 37 |
+
|
| 38 |
+
# Read the tags and the existing build number from .dist-info/WHEEL
|
| 39 |
+
wheel_file_path = os.path.join(directory, dist_info_dir, "WHEEL")
|
| 40 |
+
with open(wheel_file_path, "rb") as f:
|
| 41 |
+
info = BytesParser(policy=email.policy.compat32).parse(f)
|
| 42 |
+
tags: list[str] = info.get_all("Tag", [])
|
| 43 |
+
existing_build_number = info.get("Build")
|
| 44 |
+
|
| 45 |
+
if not tags:
|
| 46 |
+
raise WheelError(
|
| 47 |
+
f"No tags present in {dist_info_dir}/WHEEL; cannot determine target "
|
| 48 |
+
f"wheel filename"
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Set the wheel file name and add/replace/remove the Build tag in .dist-info/WHEEL
|
| 52 |
+
build_number = build_number if build_number is not None else existing_build_number
|
| 53 |
+
if build_number is not None:
|
| 54 |
+
del info["Build"]
|
| 55 |
+
if build_number:
|
| 56 |
+
info["Build"] = build_number
|
| 57 |
+
name_version += "-" + build_number
|
| 58 |
+
|
| 59 |
+
if build_number != existing_build_number:
|
| 60 |
+
with open(wheel_file_path, "wb") as f:
|
| 61 |
+
BytesGenerator(f, maxheaderlen=0).flatten(info)
|
| 62 |
+
|
| 63 |
+
# Reassemble the tags for the wheel file
|
| 64 |
+
tagline = compute_tagline(tags)
|
| 65 |
+
|
| 66 |
+
# Repack the wheel
|
| 67 |
+
wheel_path = os.path.join(dest_dir, f"{name_version}-{tagline}.whl")
|
| 68 |
+
with WheelFile(wheel_path, "w") as wf:
|
| 69 |
+
print(f"Repacking wheel as {wheel_path}...", end="", flush=True)
|
| 70 |
+
wf.write_files(directory)
|
| 71 |
+
|
| 72 |
+
print("OK")
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def compute_tagline(tags: list[str]) -> str:
|
| 76 |
+
"""Compute a tagline from a list of tags.
|
| 77 |
+
|
| 78 |
+
:param tags: A list of tags
|
| 79 |
+
:return: A tagline
|
| 80 |
+
"""
|
| 81 |
+
impls = sorted({tag.split("-")[0] for tag in tags})
|
| 82 |
+
abivers = sorted({tag.split("-")[1] for tag in tags})
|
| 83 |
+
platforms = sorted({tag.split("-")[2] for tag in tags})
|
| 84 |
+
return "-".join([".".join(impls), ".".join(abivers), ".".join(platforms)])
|
python/Lib/site-packages/setuptools/_vendor/wheel/_commands/tags.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import email.policy
|
| 4 |
+
import itertools
|
| 5 |
+
import os
|
| 6 |
+
from collections.abc import Iterable
|
| 7 |
+
from email.parser import BytesParser
|
| 8 |
+
|
| 9 |
+
from ..wheelfile import WheelFile
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]:
|
| 13 |
+
"""Add or replace tags. Supports dot-separated tags"""
|
| 14 |
+
if new_tags is None:
|
| 15 |
+
return set(original_tags)
|
| 16 |
+
|
| 17 |
+
if new_tags.startswith("+"):
|
| 18 |
+
return {*original_tags, *new_tags[1:].split(".")}
|
| 19 |
+
|
| 20 |
+
if new_tags.startswith("-"):
|
| 21 |
+
return set(original_tags) - set(new_tags[1:].split("."))
|
| 22 |
+
|
| 23 |
+
return set(new_tags.split("."))
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def tags(
|
| 27 |
+
wheel: str,
|
| 28 |
+
python_tags: str | None = None,
|
| 29 |
+
abi_tags: str | None = None,
|
| 30 |
+
platform_tags: str | None = None,
|
| 31 |
+
build_tag: str | None = None,
|
| 32 |
+
remove: bool = False,
|
| 33 |
+
) -> str:
|
| 34 |
+
"""Change the tags on a wheel file.
|
| 35 |
+
|
| 36 |
+
The tags are left unchanged if they are not specified. To specify "none",
|
| 37 |
+
use ["none"]. To append to the previous tags, a tag should start with a
|
| 38 |
+
"+". If a tag starts with "-", it will be removed from existing tags.
|
| 39 |
+
Processing is done left to right.
|
| 40 |
+
|
| 41 |
+
:param wheel: The paths to the wheels
|
| 42 |
+
:param python_tags: The Python tags to set
|
| 43 |
+
:param abi_tags: The ABI tags to set
|
| 44 |
+
:param platform_tags: The platform tags to set
|
| 45 |
+
:param build_tag: The build tag to set
|
| 46 |
+
:param remove: Remove the original wheel
|
| 47 |
+
"""
|
| 48 |
+
with WheelFile(wheel, "r") as f:
|
| 49 |
+
assert f.filename, f"{f.filename} must be available"
|
| 50 |
+
|
| 51 |
+
wheel_info = f.read(f.dist_info_path + "/WHEEL")
|
| 52 |
+
info = BytesParser(policy=email.policy.compat32).parsebytes(wheel_info)
|
| 53 |
+
|
| 54 |
+
original_wheel_name = os.path.basename(f.filename)
|
| 55 |
+
namever = f.parsed_filename.group("namever")
|
| 56 |
+
build = f.parsed_filename.group("build")
|
| 57 |
+
original_python_tags = f.parsed_filename.group("pyver").split(".")
|
| 58 |
+
original_abi_tags = f.parsed_filename.group("abi").split(".")
|
| 59 |
+
original_plat_tags = f.parsed_filename.group("plat").split(".")
|
| 60 |
+
|
| 61 |
+
tags: list[str] = info.get_all("Tag", [])
|
| 62 |
+
existing_build_tag = info.get("Build")
|
| 63 |
+
|
| 64 |
+
impls = {tag.split("-")[0] for tag in tags}
|
| 65 |
+
abivers = {tag.split("-")[1] for tag in tags}
|
| 66 |
+
platforms = {tag.split("-")[2] for tag in tags}
|
| 67 |
+
|
| 68 |
+
if impls != set(original_python_tags):
|
| 69 |
+
msg = f"Wheel internal tags {impls!r} != filename tags {original_python_tags!r}"
|
| 70 |
+
raise AssertionError(msg)
|
| 71 |
+
|
| 72 |
+
if abivers != set(original_abi_tags):
|
| 73 |
+
msg = f"Wheel internal tags {abivers!r} != filename tags {original_abi_tags!r}"
|
| 74 |
+
raise AssertionError(msg)
|
| 75 |
+
|
| 76 |
+
if platforms != set(original_plat_tags):
|
| 77 |
+
msg = (
|
| 78 |
+
f"Wheel internal tags {platforms!r} != filename tags {original_plat_tags!r}"
|
| 79 |
+
)
|
| 80 |
+
raise AssertionError(msg)
|
| 81 |
+
|
| 82 |
+
if existing_build_tag != build:
|
| 83 |
+
msg = (
|
| 84 |
+
f"Incorrect filename '{build}' "
|
| 85 |
+
f"& *.dist-info/WHEEL '{existing_build_tag}' build numbers"
|
| 86 |
+
)
|
| 87 |
+
raise AssertionError(msg)
|
| 88 |
+
|
| 89 |
+
# Start changing as needed
|
| 90 |
+
if build_tag is not None:
|
| 91 |
+
build = build_tag
|
| 92 |
+
|
| 93 |
+
final_python_tags = sorted(_compute_tags(original_python_tags, python_tags))
|
| 94 |
+
final_abi_tags = sorted(_compute_tags(original_abi_tags, abi_tags))
|
| 95 |
+
final_plat_tags = sorted(_compute_tags(original_plat_tags, platform_tags))
|
| 96 |
+
|
| 97 |
+
final_tags = [
|
| 98 |
+
namever,
|
| 99 |
+
".".join(final_python_tags),
|
| 100 |
+
".".join(final_abi_tags),
|
| 101 |
+
".".join(final_plat_tags),
|
| 102 |
+
]
|
| 103 |
+
if build:
|
| 104 |
+
final_tags.insert(1, build)
|
| 105 |
+
|
| 106 |
+
final_wheel_name = "-".join(final_tags) + ".whl"
|
| 107 |
+
|
| 108 |
+
if original_wheel_name != final_wheel_name:
|
| 109 |
+
del info["Tag"], info["Build"]
|
| 110 |
+
for a, b, c in itertools.product(
|
| 111 |
+
final_python_tags, final_abi_tags, final_plat_tags
|
| 112 |
+
):
|
| 113 |
+
info["Tag"] = f"{a}-{b}-{c}"
|
| 114 |
+
if build:
|
| 115 |
+
info["Build"] = build
|
| 116 |
+
|
| 117 |
+
original_wheel_path = os.path.join(
|
| 118 |
+
os.path.dirname(f.filename), original_wheel_name
|
| 119 |
+
)
|
| 120 |
+
final_wheel_path = os.path.join(os.path.dirname(f.filename), final_wheel_name)
|
| 121 |
+
|
| 122 |
+
with (
|
| 123 |
+
WheelFile(original_wheel_path, "r") as fin,
|
| 124 |
+
WheelFile(final_wheel_path, "w") as fout,
|
| 125 |
+
):
|
| 126 |
+
fout.comment = fin.comment # preserve the comment
|
| 127 |
+
for item in fin.infolist():
|
| 128 |
+
if item.is_dir():
|
| 129 |
+
continue
|
| 130 |
+
if item.filename == f.dist_info_path + "/RECORD":
|
| 131 |
+
continue
|
| 132 |
+
if item.filename == f.dist_info_path + "/WHEEL":
|
| 133 |
+
fout.writestr(item, info.as_bytes())
|
| 134 |
+
else:
|
| 135 |
+
fout.writestr(item, fin.read(item))
|
| 136 |
+
|
| 137 |
+
if remove:
|
| 138 |
+
os.remove(original_wheel_path)
|
| 139 |
+
|
| 140 |
+
return final_wheel_name
|
python/Lib/site-packages/setuptools/_vendor/wheel/_commands/unpack.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from ..wheelfile import WheelFile
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def unpack(path: str, dest: str = ".") -> None:
|
| 9 |
+
"""Unpack a wheel.
|
| 10 |
+
|
| 11 |
+
Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
|
| 12 |
+
is the package name and {ver} its version.
|
| 13 |
+
|
| 14 |
+
:param path: The path to the wheel.
|
| 15 |
+
:param dest: Destination directory (default to current directory).
|
| 16 |
+
"""
|
| 17 |
+
with WheelFile(path) as wf:
|
| 18 |
+
namever = wf.parsed_filename.group("namever")
|
| 19 |
+
destination = Path(dest) / namever
|
| 20 |
+
print(f"Unpacking to: {destination}...", end="", flush=True)
|
| 21 |
+
for zinfo in wf.filelist:
|
| 22 |
+
target_path = Path(wf.extract(zinfo, destination))
|
| 23 |
+
|
| 24 |
+
# Set permissions to the same values as they were set in the archive
|
| 25 |
+
# We have to do this manually due to
|
| 26 |
+
# https://github.com/python/cpython/issues/59999
|
| 27 |
+
permissions = zinfo.external_attr >> 16 & 0o777
|
| 28 |
+
target_path.chmod(permissions)
|
| 29 |
+
|
| 30 |
+
print("OK")
|
python/Lib/site-packages/setuptools/_vendor/wheel/_metadata.py
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tools for converting old- to new-style metadata.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import functools
|
| 8 |
+
import itertools
|
| 9 |
+
import os.path
|
| 10 |
+
import re
|
| 11 |
+
import textwrap
|
| 12 |
+
from collections.abc import Generator, Iterable, Iterator
|
| 13 |
+
from email.message import Message
|
| 14 |
+
from email.parser import Parser
|
| 15 |
+
from typing import Literal
|
| 16 |
+
|
| 17 |
+
from packaging.requirements import Requirement
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def _nonblank(str: str) -> bool | Literal[""]:
|
| 21 |
+
return str and not str.startswith("#")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
@functools.singledispatch
|
| 25 |
+
def yield_lines(iterable: Iterable[str]) -> Iterator[str]:
|
| 26 |
+
r"""
|
| 27 |
+
Yield valid lines of a string or iterable.
|
| 28 |
+
>>> list(yield_lines(''))
|
| 29 |
+
[]
|
| 30 |
+
>>> list(yield_lines(['foo', 'bar']))
|
| 31 |
+
['foo', 'bar']
|
| 32 |
+
>>> list(yield_lines('foo\nbar'))
|
| 33 |
+
['foo', 'bar']
|
| 34 |
+
>>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
|
| 35 |
+
['foo', 'baz #comment']
|
| 36 |
+
>>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
|
| 37 |
+
['foo', 'bar', 'baz', 'bing']
|
| 38 |
+
"""
|
| 39 |
+
return itertools.chain.from_iterable(map(yield_lines, iterable))
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@yield_lines.register(str)
|
| 43 |
+
def _(text: str) -> Iterator[str]:
|
| 44 |
+
return filter(_nonblank, map(str.strip, text.splitlines()))
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def split_sections(
|
| 48 |
+
s: str | Iterator[str],
|
| 49 |
+
) -> Generator[tuple[str | None, list[str]], None, None]:
|
| 50 |
+
"""Split a string or iterable thereof into (section, content) pairs
|
| 51 |
+
Each ``section`` is a stripped version of the section header ("[section]")
|
| 52 |
+
and each ``content`` is a list of stripped lines excluding blank lines and
|
| 53 |
+
comment-only lines. If there are any such lines before the first section
|
| 54 |
+
header, they're returned in a first ``section`` of ``None``.
|
| 55 |
+
"""
|
| 56 |
+
section = None
|
| 57 |
+
content: list[str] = []
|
| 58 |
+
for line in yield_lines(s):
|
| 59 |
+
if line.startswith("["):
|
| 60 |
+
if line.endswith("]"):
|
| 61 |
+
if section or content:
|
| 62 |
+
yield section, content
|
| 63 |
+
section = line[1:-1].strip()
|
| 64 |
+
content = []
|
| 65 |
+
else:
|
| 66 |
+
raise ValueError("Invalid section heading", line)
|
| 67 |
+
else:
|
| 68 |
+
content.append(line)
|
| 69 |
+
|
| 70 |
+
# wrap up last segment
|
| 71 |
+
yield section, content
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def safe_extra(extra: str) -> str:
|
| 75 |
+
"""Convert an arbitrary string to a standard 'extra' name
|
| 76 |
+
Any runs of non-alphanumeric characters are replaced with a single '_',
|
| 77 |
+
and the result is always lowercased.
|
| 78 |
+
"""
|
| 79 |
+
return re.sub("[^A-Za-z0-9.-]+", "_", extra).lower()
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def safe_name(name: str) -> str:
|
| 83 |
+
"""Convert an arbitrary string to a standard distribution name
|
| 84 |
+
Any runs of non-alphanumeric/. characters are replaced with a single '-'.
|
| 85 |
+
"""
|
| 86 |
+
return re.sub("[^A-Za-z0-9.]+", "-", name)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def requires_to_requires_dist(requirement: Requirement) -> str:
|
| 90 |
+
"""Return the version specifier for a requirement in PEP 345/566 fashion."""
|
| 91 |
+
if requirement.url:
|
| 92 |
+
return " @ " + requirement.url
|
| 93 |
+
|
| 94 |
+
requires_dist: list[str] = []
|
| 95 |
+
for spec in requirement.specifier:
|
| 96 |
+
requires_dist.append(spec.operator + spec.version)
|
| 97 |
+
|
| 98 |
+
if requires_dist:
|
| 99 |
+
return " " + ",".join(sorted(requires_dist))
|
| 100 |
+
else:
|
| 101 |
+
return ""
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def convert_requirements(requirements: list[str]) -> Iterator[str]:
|
| 105 |
+
"""Yield Requires-Dist: strings for parsed requirements strings."""
|
| 106 |
+
for req in requirements:
|
| 107 |
+
parsed_requirement = Requirement(req)
|
| 108 |
+
spec = requires_to_requires_dist(parsed_requirement)
|
| 109 |
+
extras = ",".join(sorted(safe_extra(e) for e in parsed_requirement.extras))
|
| 110 |
+
if extras:
|
| 111 |
+
extras = f"[{extras}]"
|
| 112 |
+
|
| 113 |
+
yield safe_name(parsed_requirement.name) + extras + spec
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def generate_requirements(
|
| 117 |
+
extras_require: dict[str | None, list[str]],
|
| 118 |
+
) -> Iterator[tuple[str, str]]:
|
| 119 |
+
"""
|
| 120 |
+
Convert requirements from a setup()-style dictionary to
|
| 121 |
+
('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples.
|
| 122 |
+
|
| 123 |
+
extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
|
| 124 |
+
using the empty extra {'': [requirements]} to hold install_requires.
|
| 125 |
+
"""
|
| 126 |
+
for extra, depends in extras_require.items():
|
| 127 |
+
condition = ""
|
| 128 |
+
extra = extra or ""
|
| 129 |
+
if ":" in extra: # setuptools extra:condition syntax
|
| 130 |
+
extra, condition = extra.split(":", 1)
|
| 131 |
+
|
| 132 |
+
extra = safe_extra(extra)
|
| 133 |
+
if extra:
|
| 134 |
+
yield "Provides-Extra", extra
|
| 135 |
+
if condition:
|
| 136 |
+
condition = "(" + condition + ") and "
|
| 137 |
+
condition += f"extra == '{extra}'"
|
| 138 |
+
|
| 139 |
+
if condition:
|
| 140 |
+
condition = " ; " + condition
|
| 141 |
+
|
| 142 |
+
for new_req in convert_requirements(depends):
|
| 143 |
+
canonical_req = str(Requirement(new_req + condition))
|
| 144 |
+
yield "Requires-Dist", canonical_req
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def pkginfo_to_metadata(egg_info_path: str, pkginfo_path: str) -> Message:
|
| 148 |
+
"""
|
| 149 |
+
Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
|
| 150 |
+
"""
|
| 151 |
+
with open(pkginfo_path, encoding="utf-8") as headers:
|
| 152 |
+
pkg_info = Parser().parse(headers)
|
| 153 |
+
|
| 154 |
+
pkg_info.replace_header("Metadata-Version", "2.1")
|
| 155 |
+
# Those will be regenerated from `requires.txt`.
|
| 156 |
+
del pkg_info["Provides-Extra"]
|
| 157 |
+
del pkg_info["Requires-Dist"]
|
| 158 |
+
requires_path = os.path.join(egg_info_path, "requires.txt")
|
| 159 |
+
if os.path.exists(requires_path):
|
| 160 |
+
with open(requires_path, encoding="utf-8") as requires_file:
|
| 161 |
+
requires = requires_file.read()
|
| 162 |
+
|
| 163 |
+
parsed_requirements = sorted(split_sections(requires), key=lambda x: x[0] or "")
|
| 164 |
+
for extra, reqs in parsed_requirements:
|
| 165 |
+
for key, value in generate_requirements({extra: reqs}):
|
| 166 |
+
if (key, value) not in pkg_info.items():
|
| 167 |
+
pkg_info[key] = value
|
| 168 |
+
|
| 169 |
+
description = pkg_info["Description"]
|
| 170 |
+
if description:
|
| 171 |
+
description_lines = pkg_info["Description"].splitlines()
|
| 172 |
+
dedented_description = "\n".join(
|
| 173 |
+
# if the first line of long_description is blank,
|
| 174 |
+
# the first line here will be indented.
|
| 175 |
+
(
|
| 176 |
+
description_lines[0].lstrip(),
|
| 177 |
+
textwrap.dedent("\n".join(description_lines[1:])),
|
| 178 |
+
"\n",
|
| 179 |
+
)
|
| 180 |
+
)
|
| 181 |
+
pkg_info.set_payload(dedented_description)
|
| 182 |
+
del pkg_info["Description"]
|
| 183 |
+
|
| 184 |
+
return pkg_info
|
python/Lib/site-packages/setuptools/_vendor/wheel/_setuptools_logging.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# copied from setuptools.logging, omitting monkeypatching
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import logging
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def _not_warning(record: logging.LogRecord) -> bool:
|
| 9 |
+
return record.levelno < logging.WARNING
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def configure() -> None:
|
| 13 |
+
"""
|
| 14 |
+
Configure logging to emit warning and above to stderr
|
| 15 |
+
and everything else to stdout. This behavior is provided
|
| 16 |
+
for compatibility with distutils.log but may change in
|
| 17 |
+
the future.
|
| 18 |
+
"""
|
| 19 |
+
err_handler = logging.StreamHandler()
|
| 20 |
+
err_handler.setLevel(logging.WARNING)
|
| 21 |
+
out_handler = logging.StreamHandler(sys.stdout)
|
| 22 |
+
out_handler.addFilter(_not_warning)
|
| 23 |
+
handlers = err_handler, out_handler
|
| 24 |
+
logging.basicConfig(
|
| 25 |
+
format="{message}", style="{", handlers=handlers, level=logging.DEBUG
|
| 26 |
+
)
|