git: 98ded7cd825c - main - devel/py-poetry: Fix build after fa2d4aa15778abdb828847797f1c11f6292c14d4

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 09 Jul 2023 15:33:06 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=98ded7cd825c3450f170d10c3d24fdfcf8ea412e

commit 98ded7cd825c3450f170d10c3d24fdfcf8ea412e
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-07-09 15:32:48 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-07-09 15:32:48 +0000

    devel/py-poetry: Fix build after fa2d4aa15778abdb828847797f1c11f6292c14d4
    
    - Bump PORTREVISION for dependency and package change
    
    Obtained from:  https://github.com/python-poetry/poetry/commit/fca3d5d04fb01bbb3c77e810094a99732b7d024c
---
 devel/py-poetry/Makefile                 |   6 +-
 devel/py-poetry/files/patch-cachecontrol | 152 +++++++++++++++++++++++++++++++
 2 files changed, 154 insertions(+), 4 deletions(-)

diff --git a/devel/py-poetry/Makefile b/devel/py-poetry/Makefile
index 7a139dcb92d6..622aef788774 100644
--- a/devel/py-poetry/Makefile
+++ b/devel/py-poetry/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	poetry
 PORTVERSION=	1.5.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -14,16 +15,14 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}poetry-core>=1.1.0:devel/py-poetry-core@${PY_FLAVOR}
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}build>=0.10.0<0.11:devel/py-build@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}cachecontrol>=0.12.9<0.13:www/py-cachecontrol@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}cachecontrol>=0.13.0<0.14:www/py-cachecontrol@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}cleo>=2.0.0<3:devel/py-cleo@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}crashtest>=0.4.1<0.5:devel/py-crashtest@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}dulwich>=0.21.2<0.22:devel/py-dulwich@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}filelock>=3.8.0<4:sysutils/py-filelock@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}html5lib>=1.0<2:www/py-html5lib@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}installer>=0.7.0<0.8:devel/py-installer@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}jsonschema>=4.10.0<5:devel/py-jsonschema@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}keyring>=23.9.0,1<24,1:security/py-keyring@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}lockfile>=0.12.2<0.13:devel/py-lockfile@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}packaging>=20.4:devel/py-packaging@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pexpect>=4.7.0<5:misc/py-pexpect@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pkginfo>=1.9.4<2:sysutils/py-pkginfo@${PY_FLAVOR} \
@@ -36,7 +35,6 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}build>=0.10.0<0.11:devel/py-build@${PY_FLAVO
 		${PYTHON_PKGNAMEPREFIX}shellingham>=1.5<2:devel/py-shellingham@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}tomlkit>=0.11.4<1.0.0:textproc/py-tomlkit@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}trove-classifiers>=2022.5.19:devel/py-trove-classifiers@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}urllib3>=1.26.0,1<2,1:net/py-urllib3@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}virtualenv>=20.22.0<21:devel/py-virtualenv@${PY_FLAVOR}
 
 USES=		python
diff --git a/devel/py-poetry/files/patch-cachecontrol b/devel/py-poetry/files/patch-cachecontrol
new file mode 100644
index 000000000000..79e6cac6a490
--- /dev/null
+++ b/devel/py-poetry/files/patch-cachecontrol
@@ -0,0 +1,152 @@
+Obtained from:	https://github.com/python-poetry/poetry/commit/fca3d5d04fb01bbb3c77e810094a99732b7d024c
+
+--- pyproject.toml.orig	2023-05-19 12:27:02 UTC
++++ pyproject.toml
+@@ -36,17 +36,15 @@ poetry-core = "1.6.0"
+ poetry-plugin-export = "^1.3.1"
+ "backports.cached-property" = { version = "^1.0.2", python = "<3.8" }
+ build = "^0.10.0"
+-cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
++cachecontrol = { version = "^0.13.0", extras = ["filecache"] }
+ cleo = "^2.0.0"
+ crashtest = "^0.4.1"
+ dulwich = "^0.21.2"
+-filelock = "^3.8.0"
+ html5lib = "^1.0"
+ importlib-metadata = { version = ">=4.4", python = "<3.10" }
+ installer = "^0.7.0"
+ jsonschema = "^4.10.0"
+ keyring = "^23.9.0"
+-lockfile = "^0.12.2"
+ # packaging uses calver, so version is unclamped
+ packaging = ">=20.4"
+ pexpect = "^4.7.0"
+@@ -62,7 +60,6 @@ tomlkit = ">=0.11.4,<1.0.0"
+ trove-classifiers = ">=2022.5.19"
+ virtualenv = "^20.22.0"
+ xattr = { version = "^0.10.0", markers = "sys_platform == 'darwin'" }
+-urllib3 = "^1.26.0"
+ 
+ [tool.poetry.group.dev.dependencies]
+ pre-commit = "^2.6"
+@@ -189,18 +186,15 @@ warn_unused_ignores = false
+ 
+ [[tool.mypy.overrides]]
+ module = [
+-    'cachecontrol.*',
+     'cachy.*',
+     'deepdiff.*',
+     'httpretty.*',
+     'keyring.*',
+-    'lockfile.*',
+     'pexpect.*',
+     'requests_toolbelt.*',
+     'shellingham.*',
+     'virtualenv.*',
+     'xattr.*',
+-    'zipp.*',
+ ]
+ ignore_missing_imports = true
+ 
+--- src/poetry/publishing/uploader.py.orig	2023-05-19 12:27:02 UTC
++++ src/poetry/publishing/uploader.py
+@@ -11,17 +11,14 @@ import requests
+ 
+ from poetry.core.masonry.metadata import Metadata
+ from poetry.core.masonry.utils.helpers import distribution_name
+-from requests import adapters
+ from requests.exceptions import ConnectionError
+ from requests.exceptions import HTTPError
+ from requests_toolbelt import user_agent
+ from requests_toolbelt.multipart import MultipartEncoder
+ from requests_toolbelt.multipart import MultipartEncoderMonitor
+-from urllib3 import util
+ 
+ from poetry.__version__ import __version__
+ from poetry.utils.constants import REQUESTS_TIMEOUT
+-from poetry.utils.constants import STATUS_FORCELIST
+ from poetry.utils.patterns import wheel_file_re
+ 
+ 
+@@ -64,18 +61,6 @@ class Uploader:
+         return agent
+ 
+     @property
+-    def adapter(self) -> adapters.HTTPAdapter:
+-        retry = util.Retry(
+-            connect=5,
+-            total=10,
+-            allowed_methods=["GET"],
+-            respect_retry_after_header=True,
+-            status_forcelist=STATUS_FORCELIST,
+-        )
+-
+-        return adapters.HTTPAdapter(max_retries=retry)
+-
+-    @property
+     def files(self) -> list[Path]:
+         dist = self._poetry.file.path.parent / "dist"
+         version = self._package.version.to_string()
+@@ -97,9 +82,6 @@ class Uploader:
+             session.auth = auth
+ 
+         session.headers["User-Agent"] = self.user_agent
+-        for scheme in ("http://", "https://"):
+-            session.mount(scheme, self.adapter)
+-
+         return session
+ 
+     def get_auth(self) -> tuple[str, str] | None:
+--- src/poetry/utils/authenticator.py.orig	2023-05-19 12:27:02 UTC
++++ src/poetry/utils/authenticator.py
+@@ -12,7 +12,6 @@ from pathlib import Path
+ from typing import TYPE_CHECKING
+ from typing import Any
+ 
+-import lockfile
+ import requests
+ import requests.auth
+ import requests.exceptions
+@@ -20,7 +19,6 @@ import requests.exceptions
+ from cachecontrol import CacheControlAdapter
+ from cachecontrol.caches import FileCache
+ from cachecontrol.caches.file_cache import url_to_file_path
+-from filelock import FileLock
+ 
+ from poetry.config.config import Config
+ from poetry.exceptions import PoetryException
+@@ -38,26 +36,6 @@ if TYPE_CHECKING:
+ logger = logging.getLogger(__name__)
+ 
+ 
+-class FileLockLockFile(lockfile.LockBase):  # type: ignore[misc]
+-    # The default LockFile from the lockfile package as used by cachecontrol can remain
+-    # locked if a process exits ungracefully.  See eg
+-    # <https://github.com/python-poetry/poetry/issues/6030#issuecomment-1189383875>.
+-    #
+-    # FileLock from the filelock package does not have this problem, so we use that to
+-    # construct something compatible with cachecontrol.
+-    def __init__(
+-        self, path: str, threaded: bool = True, timeout: float | None = None
+-    ) -> None:
+-        super().__init__(path, threaded, timeout)
+-        self.file_lock = FileLock(self.lock_file)
+-
+-    def acquire(self, timeout: float | None = None) -> None:
+-        self.file_lock.acquire(timeout=timeout)
+-
+-    def release(self) -> None:
+-        self.file_lock.release()
+-
+-
+ @dataclasses.dataclass(frozen=True)
+ class RepositoryCertificateConfig:
+     cert: Path | None = dataclasses.field(default=None)
+@@ -149,7 +127,6 @@ class Authenticator:
+                     / (cache_id or "_default_cache")
+                     / "_http"
+                 ),
+-                lock_class=FileLockLockFile,
+             )
+             if not disable_cache
+             else None