git: 866c0cf991d7 - main - devel/py-poetry: Allow build with py-dulwich 0.24.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Tue, 30 Sep 2025 10:58:17 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=866c0cf991d7e2b3dd2479ab9db25227f674b54e

commit 866c0cf991d7e2b3dd2479ab9db25227f674b54e
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2025-09-30 10:43:35 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2025-09-30 10:50:57 +0000

    devel/py-poetry: Allow build with py-dulwich 0.24.0+
    
    - Bump PORTREVISION for package change
    
    Obtained from:  https://github.com/python-poetry/poetry/commit/68ea7c862b9ab14ea4644a9d4f12b10c496ba85f
---
 devel/py-poetry/Makefile            |  3 +-
 devel/py-poetry/files/patch-dulwich | 65 +++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/devel/py-poetry/Makefile b/devel/py-poetry/Makefile
index 59fb287d23ce..1c519ceb49b5 100644
--- a/devel/py-poetry/Makefile
+++ b/devel/py-poetry/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	poetry
 PORTVERSION=	2.1.4
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI \
 		https://github.com/python-poetry/poetry/releases/download/${PORTVERSION}/
@@ -17,7 +18,7 @@ BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}poetry-core>=2.0:devel/py-poetry-core@${PY
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}build>=1.2.1<2.0.0:devel/py-build@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}cachecontrol>=0.14.0<0.15.0:www/py-cachecontrol@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}cleo>=2.1.0<3.0.0:devel/py-cleo@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}dulwich>=0.22.6<0.23.0:devel/py-dulwich@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}dulwich>=0.24.0<0.25.0:devel/py-dulwich@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}fastjsonschema>=2.18.0<3.0.0:devel/py-fastjsonschema@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}findpython>=0.6.2:devel/py-findpython@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}installer>=0.7.0<0.8.0:devel/py-installer@${PY_FLAVOR} \
diff --git a/devel/py-poetry/files/patch-dulwich b/devel/py-poetry/files/patch-dulwich
new file mode 100644
index 000000000000..cbb8acb9209b
--- /dev/null
+++ b/devel/py-poetry/files/patch-dulwich
@@ -0,0 +1,65 @@
+Obtained from:	https://github.com/python-poetry/poetry/commit/68ea7c862b9ab14ea4644a9d4f12b10c496ba85f
+
+--- pyproject.toml.orig	1970-01-01 00:00:00 UTC
++++ pyproject.toml
+@@ -8,7 +8,7 @@ dependencies = [
+     "build (>=1.2.1,<2.0.0)",
+     "cachecontrol[filecache] (>=0.14.0,<0.15.0)",
+     "cleo (>=2.1.0,<3.0.0)",
+-    "dulwich (>=0.22.6,<0.23.0)",
++    "dulwich (>=0.24.0,<0.25.0)",
+     "fastjsonschema (>=2.18.0,<3.0.0)",
+     # <8.7 because .metadata() (and Distribution.metadata) can now return None,
+     # which requires some adaptions to our code.
+--- src/poetry/vcs/git/backend.py.orig	1970-01-01 00:00:00 UTC
++++ src/poetry/vcs/git/backend.py
+@@ -355,7 +355,7 @@ class Git:
+ 
+         try:
+             with local:
+-                local.reset_index()
++                local.get_worktree().reset_index()
+         except (AssertionError, KeyError) as e:
+             # this implies the ref we need does not exist or is invalid
+             if isinstance(e, KeyError):
+--- tests/vcs/git/conftest.py.orig	1970-01-01 00:00:00 UTC
++++ tests/vcs/git/conftest.py
+@@ -16,12 +16,13 @@ def temp_repo(tmp_path: Path) -> TempRepoFixture:
+ def temp_repo(tmp_path: Path) -> TempRepoFixture:
+     """Temporary repository with 2 commits"""
+     repo = dulwich.repo.Repo.init(str(tmp_path))
++    worktree = repo.get_worktree()
+ 
+     # init commit
+     (tmp_path / "foo").write_text("foo", encoding="utf-8")
+-    repo.stage(["foo"])
++    worktree.stage(["foo"])
+ 
+-    init_commit = repo.do_commit(
++    init_commit = worktree.commit(
+         committer=b"User <user@example.com>",
+         author=b"User <user@example.com>",
+         message=b"init",
+@@ -30,8 +31,8 @@ def temp_repo(tmp_path: Path) -> TempRepoFixture:
+ 
+     # one commit which is not "head"
+     (tmp_path / "bar").write_text("bar", encoding="utf-8")
+-    repo.stage(["bar"])
+-    middle_commit = repo.do_commit(
++    worktree.stage(["bar"])
++    middle_commit = worktree.commit(
+         committer=b"User <user@example.com>",
+         author=b"User <user@example.com>",
+         message=b"extra",
+@@ -40,9 +41,9 @@ def temp_repo(tmp_path: Path) -> TempRepoFixture:
+ 
+     # extra commit
+     (tmp_path / "third").write_text("third file", encoding="utf-8")
+-    repo.stage(["third"])
++    worktree.stage(["third"])
+ 
+-    head_commit = repo.do_commit(
++    head_commit = worktree.commit(
+         committer=b"User <user@example.com>",
+         author=b"User <user@example.com>",
+         message=b"extra",