Skip to content

Commit

Permalink
git subrepo clone --force https://github.com/prrvchr/uno.git
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "uno"
  merged:   "3b8ab22"
upstream:
  origin:   "https://github.com/prrvchr/uno.git"
  branch:   "main"
  commit:   "3b8ab22"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
  • Loading branch information
prrvchr committed Aug 25, 2024
1 parent 5314a05 commit 37172c4
Show file tree
Hide file tree
Showing 173 changed files with 2,348 additions and 2,083 deletions.
4 changes: 2 additions & 2 deletions uno/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/prrvchr/uno.git
branch = main
commit = 329d17790433add56bc56bb30bb4c0b8a7fae0ae
parent = 509ba9ed9fd424d5aa374ff0b69bbff65f3a7c38
commit = 3b8ab224b181540e1c06dfdaf6bde35455374759
parent = 5314a054f9e48f4801dffdc4bbd260d4ced40f38
method = merge
cmdver = 0.4.3
3 changes: 1 addition & 2 deletions uno/lib/python/_distutils_hack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# don't import any costly modules
import sys
import os

import sys

report_url = (
"https://github.com/pypa/setuptools/issues/new?"
Expand Down
152 changes: 73 additions & 79 deletions uno/lib/python/pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,60 @@
if sys.version_info < (3, 8): # noqa: UP036 # Check for unsupported versions
raise RuntimeError("Python 3.8 or later is required")

import os
import _imp
import collections
import email.parser
import errno
import functools
import importlib
import importlib.abc
import importlib.machinery
import inspect
import io
import time
import ntpath
import operator
import os
import pkgutil
import platform
import plistlib
import posixpath
import re
import stat
import tempfile
import textwrap
import time
import types
import warnings
import zipfile
import zipimport
from pkgutil import get_importer
from typing import (
TYPE_CHECKING,
Any,
BinaryIO,
Literal,
Callable,
Dict,
Iterable,
Iterator,
Literal,
Mapping,
MutableSequence,
NamedTuple,
NoReturn,
Tuple,
Union,
TYPE_CHECKING,
Protocol,
Callable,
Iterable,
Tuple,
TypeVar,
Union,
overload,
)
import zipfile
import zipimport
import warnings
import stat
import functools
import pkgutil
import operator
import platform
import collections
import plistlib
import email.parser
import errno
import tempfile
import textwrap
import inspect
import ntpath
import posixpath
import importlib
import importlib.abc
import importlib.machinery
from pkgutil import get_importer

import _imp

sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip
# workaround for #4476
sys.modules.pop('backports', None)

# capture these to bypass sandboxing
from os import utime
from os import open as os_open
from os.path import isdir, split
from os import open as os_open, utime # isort: skip
from os.path import isdir, split # isort: skip

try:
from os import mkdir, rename, unlink
Expand All @@ -92,21 +90,17 @@
# no write support, probably under GAE
WRITE_SUPPORT = False

import packaging.markers
import packaging.requirements
import packaging.specifiers
from jaraco.text import (
yield_lines,
drop_comment,
join_continuation,
)
from packaging import markers as _packaging_markers
from packaging import requirements as _packaging_requirements
from packaging import utils as _packaging_utils
from packaging import version as _packaging_version
import packaging.utils
import packaging.version
from jaraco.text import drop_comment, join_continuation, yield_lines
from platformdirs import user_cache_dir as _user_cache_dir

if TYPE_CHECKING:
from _typeshed import BytesPath, StrPath, StrOrBytesPath
from typing_extensions import Self
from _typeshed import BytesPath, StrOrBytesPath, StrPath
from typing_extensions import Self, TypeAlias

warnings.warn(
"pkg_resources is deprecated as an API. "
Expand All @@ -118,20 +112,20 @@
_T = TypeVar("_T")
_DistributionT = TypeVar("_DistributionT", bound="Distribution")
# Type aliases
_NestedStr = Union[str, Iterable[Union[str, Iterable["_NestedStr"]]]]
_InstallerTypeT = Callable[["Requirement"], "_DistributionT"]
_InstallerType = Callable[["Requirement"], Union["Distribution", None]]
_PkgReqType = Union[str, "Requirement"]
_EPDistType = Union["Distribution", _PkgReqType]
_MetadataType = Union["IResourceProvider", None]
_ResolvedEntryPoint = Any # Can be any attribute in the module
_ResourceStream = Any # TODO / Incomplete: A readable file-like object
_NestedStr: TypeAlias = Union[str, Iterable[Union[str, Iterable["_NestedStr"]]]]
_StrictInstallerType: TypeAlias = Callable[["Requirement"], "_DistributionT"]
_InstallerType: TypeAlias = Callable[["Requirement"], Union["Distribution", None]]
_PkgReqType: TypeAlias = Union[str, "Requirement"]
_EPDistType: TypeAlias = Union["Distribution", _PkgReqType]
_MetadataType: TypeAlias = Union["IResourceProvider", None]
_ResolvedEntryPoint: TypeAlias = Any # Can be any attribute in the module
_ResourceStream: TypeAlias = Any # TODO / Incomplete: A readable file-like object
# Any object works, but let's indicate we expect something like a module (optionally has __loader__ or __file__)
_ModuleLike = Union[object, types.ModuleType]
_ModuleLike: TypeAlias = Union[object, types.ModuleType]
# Any: Should be _ModuleLike but we end up with issues where _ModuleLike doesn't have _ZipLoaderModule's __loader__
_ProviderFactoryType = Callable[[Any], "IResourceProvider"]
_DistFinderType = Callable[[_T, str, bool], Iterable["Distribution"]]
_NSHandlerType = Callable[[_T, str, str, types.ModuleType], Union[str, None]]
_ProviderFactoryType: TypeAlias = Callable[[Any], "IResourceProvider"]
_DistFinderType: TypeAlias = Callable[[_T, str, bool], Iterable["Distribution"]]
_NSHandlerType: TypeAlias = Callable[[_T, str, str, types.ModuleType], Union[str, None]]
_AdapterT = TypeVar(
"_AdapterT", _DistFinderType[Any], _ProviderFactoryType, _NSHandlerType[Any]
)
Expand All @@ -156,7 +150,7 @@ class PEP440Warning(RuntimeWarning):
"""


parse_version = _packaging_version.Version
parse_version = packaging.version.Version

_state_vars: dict[str, str] = {}

Expand Down Expand Up @@ -801,7 +795,7 @@ def add(
return

self.by_key[dist.key] = dist
normalized_name = _packaging_utils.canonicalize_name(dist.key)
normalized_name = packaging.utils.canonicalize_name(dist.key)
self.normalized_to_canonical_keys[normalized_name] = dist.key
if dist.key not in keys:
keys.append(dist.key)
Expand All @@ -814,7 +808,7 @@ def resolve(
self,
requirements: Iterable[Requirement],
env: Environment | None,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
replace_conflicting: bool = False,
extras: tuple[str, ...] | None = None,
) -> list[_DistributionT]: ...
Expand All @@ -824,7 +818,7 @@ def resolve(
requirements: Iterable[Requirement],
env: Environment | None = None,
*,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
replace_conflicting: bool = False,
extras: tuple[str, ...] | None = None,
) -> list[_DistributionT]: ...
Expand All @@ -841,7 +835,7 @@ def resolve(
self,
requirements: Iterable[Requirement],
env: Environment | None = None,
installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
installer: _InstallerType | None | _StrictInstallerType[_DistributionT] = None,
replace_conflicting: bool = False,
extras: tuple[str, ...] | None = None,
) -> list[Distribution] | list[_DistributionT]:
Expand Down Expand Up @@ -947,7 +941,7 @@ def find_plugins(
self,
plugin_env: Environment,
full_env: Environment | None,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
fallback: bool = True,
) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ...
@overload
Expand All @@ -956,7 +950,7 @@ def find_plugins(
plugin_env: Environment,
full_env: Environment | None = None,
*,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
fallback: bool = True,
) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ...
@overload
Expand All @@ -971,7 +965,7 @@ def find_plugins(
self,
plugin_env: Environment,
full_env: Environment | None = None,
installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
installer: _InstallerType | None | _StrictInstallerType[_DistributionT] = None,
fallback: bool = True,
) -> tuple[
list[Distribution] | list[_DistributionT],
Expand Down Expand Up @@ -1217,7 +1211,7 @@ def best_match(
self,
req: Requirement,
working_set: WorkingSet,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
replace_conflicting: bool = False,
) -> _DistributionT: ...
@overload
Expand All @@ -1232,7 +1226,7 @@ def best_match(
self,
req: Requirement,
working_set: WorkingSet,
installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
installer: _InstallerType | None | _StrictInstallerType[_DistributionT] = None,
replace_conflicting: bool = False,
) -> Distribution | None:
"""Find distribution best matching `req` and usable on `working_set`
Expand Down Expand Up @@ -1265,7 +1259,7 @@ def best_match(
def obtain(
self,
requirement: Requirement,
installer: _InstallerTypeT[_DistributionT],
installer: _StrictInstallerType[_DistributionT],
) -> _DistributionT: ...
@overload
def obtain(
Expand All @@ -1285,7 +1279,7 @@ def obtain(
installer: Callable[[Requirement], None]
| _InstallerType
| None
| _InstallerTypeT[_DistributionT] = None,
| _StrictInstallerType[_DistributionT] = None,
) -> Distribution | None:
"""Obtain a distribution matching `requirement` (e.g. via download)
Expand Down Expand Up @@ -1561,8 +1555,8 @@ def safe_version(version: str) -> str:
"""
try:
# normalize the version
return str(_packaging_version.Version(version))
except _packaging_version.InvalidVersion:
return str(packaging.version.Version(version))
except packaging.version.InvalidVersion:
version = version.replace(' ', '.')
return re.sub('[^A-Za-z0-9.]+', '-', version)

Expand Down Expand Up @@ -1639,9 +1633,9 @@ def evaluate_marker(text: str, extra: str | None = None) -> bool:
This implementation uses the 'pyparsing' module.
"""
try:
marker = _packaging_markers.Marker(text)
marker = packaging.markers.Marker(text)
return marker.evaluate()
except _packaging_markers.InvalidMarker as e:
except packaging.markers.InvalidMarker as e:
raise SyntaxError(e) from e


Expand Down Expand Up @@ -3001,20 +2995,20 @@ def parsed_version(self):
if not hasattr(self, "_parsed_version"):
try:
self._parsed_version = parse_version(self.version)
except _packaging_version.InvalidVersion as ex:
except packaging.version.InvalidVersion as ex:
info = f"(package: {self.project_name})"
if hasattr(ex, "add_note"):
ex.add_note(info) # PEP 678
raise
raise _packaging_version.InvalidVersion(f"{str(ex)} {info}") from None
raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None

return self._parsed_version

@property
def _forgiving_parsed_version(self):
try:
return self.parsed_version
except _packaging_version.InvalidVersion as ex:
except packaging.version.InvalidVersion as ex:
self._parsed_version = parse_version(_forgiving_version(self.version))

notes = "\n".join(getattr(ex, "__notes__", [])) # PEP 678
Expand Down Expand Up @@ -3194,7 +3188,7 @@ def from_filename(

def as_requirement(self):
"""Return a ``Requirement`` that matches this distribution exactly"""
if isinstance(self.parsed_version, _packaging_version.Version):
if isinstance(self.parsed_version, packaging.version.Version):
spec = "%s==%s" % (self.project_name, self.parsed_version)
else:
spec = "%s===%s" % (self.project_name, self.parsed_version)
Expand Down Expand Up @@ -3452,11 +3446,11 @@ def parse_requirements(strs: _NestedStr) -> map[Requirement]:
return map(Requirement, join_continuation(map(drop_comment, yield_lines(strs))))


class RequirementParseError(_packaging_requirements.InvalidRequirement):
class RequirementParseError(packaging.requirements.InvalidRequirement):
"Compatibility wrapper for InvalidRequirement"


class Requirement(_packaging_requirements.Requirement):
class Requirement(packaging.requirements.Requirement):
# prefer variable length tuple to set (as found in
# packaging.requirements.Requirement)
extras: tuple[str, ...] # type: ignore[assignment]
Expand Down
5 changes: 3 additions & 2 deletions uno/lib/python/pkg_resources/tests/test_find_distributions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from pathlib import Path
import shutil
from pathlib import Path

import pytest
import pkg_resources

import pkg_resources

TESTS_DATA_DIR = Path(__file__).parent / 'data'

Expand Down
Loading

0 comments on commit 37172c4

Please sign in to comment.