Patch-Source: https://github.com/archlinux/svntogit-community/blob/253ab7a3729e/trunk/python-pdm-pep517-1.0.5-devendor.patch amended to work with packaging 22.0 diff -ruN a/pdm/pep517/base.py b/pdm/pep517/base.py diff --git a/pdm/pep517/base.py b/pdm/pep517/base.py index 718f651..c70e5d1 100644 --- a/pdm/pep517/base.py +++ b/pdm/pep517/base.py @@ -7,7 +7,7 @@ import warnings from pathlib import Path from typing import Any, Iterator, Mapping, TypeVar, cast -from pdm.pep517._vendor import tomli +import tomli from pdm.pep517.exceptions import MetadataError, PDMWarning, ProjectError from pdm.pep517.metadata import Metadata from pdm.pep517.utils import is_python_package, safe_version, to_filename diff --git a/pdm/pep517/license.py b/pdm/pep517/license.py index bccd58f..efabeca 100644 --- a/pdm/pep517/license.py +++ b/pdm/pep517/license.py @@ -1,6 +1,6 @@ import warnings -from pdm.pep517._vendor.license_expression import ( +from license_expression import ( LicenseSymbol, Licensing, get_spdx_licensing, diff --git a/pdm/pep517/metadata.py b/pdm/pep517/metadata.py index 566ff45..0c32d20 100644 --- a/pdm/pep517/metadata.py +++ b/pdm/pep517/metadata.py @@ -5,7 +5,7 @@ import os from pathlib import Path from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar, cast -from pdm.pep517._vendor.packaging.requirements import InvalidRequirement, Requirement +from packaging.requirements import InvalidRequirement, Requirement from pdm.pep517.exceptions import MetadataError, PDMWarning, ProjectError from pdm.pep517.utils import ( cd, diff --git a/pdm/pep517/scm.py b/pdm/pep517/scm.py index f283c68..ec66683 100644 --- a/pdm/pep517/scm.py +++ b/pdm/pep517/scm.py @@ -14,8 +14,8 @@ from datetime import datetime from pathlib import Path from typing import Any, Iterable, NamedTuple -from pdm.pep517._vendor.packaging.version import LegacyVersion, Version -from pdm.pep517._vendor.packaging.version import parse as parse_version +from packaging.version import Version +from packaging.version import parse as parse_version DEFAULT_TAG_REGEX = re.compile( r"^(?:[\w-]+-)?(?P[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$" @@ -53,7 +53,7 @@ def _subprocess_call( class VersionInfo(NamedTuple): - version: Version | LegacyVersion + version: Version distance: int | None dirty: bool node: str | None @@ -61,7 +61,7 @@ class VersionInfo(NamedTuple): def meta( - tag: str | Version | LegacyVersion, + tag: str | Version, distance: int | None = None, dirty: bool = False, node: str | None = None, @@ -136,7 +136,7 @@ def _parse_version_tag(tag: str) -> _ParseResult | None: return result -def tag_to_version(tag: str) -> Version | LegacyVersion: +def tag_to_version(tag: str) -> Version: """ take a tag that might be prefixed with a keyword and return only the version part :param config: optional configuration object @@ -154,7 +154,7 @@ def tag_to_version(tag: str) -> Version | LegacyVersion: return parse_version(version) -def tags_to_versions(tags: Iterable[str]) -> list[Version | LegacyVersion]: +def tags_to_versions(tags: Iterable[str]) -> list[Version]: """ take tags that might be prefixed with a keyword and return only the version part :param tags: an iterable of tags @@ -241,7 +241,7 @@ def _hg_tagdist_normalize_tagcommit( return meta(tag) -def guess_next_version(tag_version: Version | LegacyVersion) -> str: +def guess_next_version(tag_version: Version) -> str: version = _strip_local(str(tag_version)) return _bump_dev(version) or _bump_regex(version) diff --git a/pdm/pep517/sdist.py b/pdm/pep517/sdist.py index 3b440ec..7abcced 100644 --- a/pdm/pep517/sdist.py +++ b/pdm/pep517/sdist.py @@ -6,7 +6,8 @@ import tempfile from copy import copy from typing import Any, Iterator -from pdm.pep517._vendor import tomli, tomli_w +import tomli +import tomli_w from pdm.pep517.base import Builder diff --git a/pdm/pep517/utils.py b/pdm/pep517/utils.py index 7517ebb..7f5447b 100644 --- a/pdm/pep517/utils.py +++ b/pdm/pep517/utils.py @@ -12,10 +12,10 @@ from fnmatch import fnmatchcase from pathlib import Path from typing import Callable, Generator, Iterable, Match -from pdm.pep517._vendor.packaging import tags -from pdm.pep517._vendor.packaging.markers import Marker -from pdm.pep517._vendor.packaging.requirements import Requirement -from pdm.pep517._vendor.packaging.version import InvalidVersion, Version +from packaging import tags +from packaging.markers import Marker +from packaging.requirements import Requirement +from packaging.version import InvalidVersion, Version from pdm.pep517.macosx_platform import calculate_macosx_platform_tag diff --git a/pdm/pep517/validator.py b/pdm/pep517/validator.py index b9fc7aa..3852be1 100644 --- a/pdm/pep517/validator.py +++ b/pdm/pep517/validator.py @@ -1,6 +1,6 @@ from typing import Mapping -from pdm.pep517._vendor import cerberus +import cerberus from pdm.pep517.exceptions import PEP621ValidationError README_RULE = [ diff --git a/pdm/pep517/wheel.py b/pdm/pep517/wheel.py index c47cbca..1a6303f 100644 --- a/pdm/pep517/wheel.py +++ b/pdm/pep517/wheel.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import Any, BinaryIO, Generator, Mapping, NamedTuple, TextIO from pdm.pep517 import __version__ -from pdm.pep517._vendor.packaging import tags -from pdm.pep517._vendor.packaging.specifiers import SpecifierSet +from packaging import tags +from packaging.specifiers import SpecifierSet from pdm.pep517.base import Builder from pdm.pep517.exceptions import BuildError, PDMWarning from pdm.pep517.utils import get_abi_tag, get_platform, show_warning diff --git a/tests/test_metadata.py b/tests/test_metadata.py index c9c318e..1116ad7 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -5,7 +5,7 @@ from typing import Optional import pytest -from pdm.pep517._vendor import tomli +import tomli from pdm.pep517.metadata import Metadata from tests import FIXTURES