diff --git a/scripts/vendor.py b/scripts/vendor.py index 24480e7..dbe2af5 100755 --- a/scripts/vendor.py +++ b/scripts/vendor.py @@ -59,7 +59,7 @@ class Package: def ensure(self): dir = Path(__file__).parent / self.name if not dir.is_dir(): - subprocess.run(["git", "clone", self.url]) + subprocess.run(["git", "clone", self.url, dir]) subprocess.run(["git", "-C", dir, "checkout", self.rev]) @property @@ -173,16 +173,17 @@ SpecifierSet = v_packaging_SpecifierSet Package( name="tomli", url="https://github.com/hukkin/tomli.git", - rev="2.0.1", + # rev="2.0.1", + rev="a6138675bcca68eea5b8abec7c2ec06d57f965a0", files=( ("_types", [[7, 11]]), ("_re", [[14, 107]]), ("_parser", [[20, 691]]), ), prefix=""" -try: +if sys.version_info >= (3, 11): from tomllib import loads as toml_loads -except ImportError: +else: # MODIFIED FROM https://github.com/hukkin/tomli # see below for original license # SPDX-License-Identifier: MIT @@ -194,7 +195,6 @@ except ImportError: from collections.abc import Iterable # noqa from functools import lru_cache # noqa from datetime import date, datetime, time, timedelta, timezone, tzinfo # noqa - from io import BinaryIO from types import MappingProxyType # noqa from typing import IO, Any, Callable, NamedTuple # noqa """, diff --git a/src/viv/viv.py b/src/viv/viv.py index 15cea97..030d617 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -58,9 +58,9 @@ __version__ = "2023.1003-pep723" #### START VENDORED TOMLI #### -try: +if sys.version_info >= (3, 11): from tomllib import loads as toml_loads -except ImportError: +else: # MODIFIED FROM https://github.com/hukkin/tomli # see below for original license # SPDX-License-Identifier: MIT @@ -71,7 +71,6 @@ except ImportError: from collections.abc import Iterable # noqa from functools import lru_cache # noqa from datetime import date, datetime, time, timedelta, timezone, tzinfo # noqa - from io import BinaryIO from types import MappingProxyType # noqa from typing import IO, Any, Callable, NamedTuple # noqa @@ -190,7 +189,7 @@ except ImportError: pass def v_tomli_load( - __fp: BinaryIO, *, parse_float: v_tomli_ParseFloat = float + __fp: IO[bytes], *, parse_float: v_tomli_ParseFloat = float ) -> dict[str, Any]: b = __fp.read() try: @@ -1631,7 +1630,8 @@ class v_packaging_SpecifierSet(v_packaging_BaseSpecifier): specifier._prereleases = self._prereleases else: raise ValueError( - "Cannot combine v_packaging_SpecifierSets with True and False prerelease overrides." # noqa + "Cannot combine v_packaging_SpecifierSets " + "with True and False prerelease overrides." ) return specifier