dev-python/dulwich: Bump to 0.24.1

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2025-09-15 04:15:49 +02:00
parent a316afb371
commit 9868b294c8
4 changed files with 344 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
DIST autocfg-1.5.0.crate 18729 BLAKE2B 27580e39b366c6fca02c9db09997b6415c409f12068f1249184268bf96fd85ba659e25ec730f99e10caf452f96c486f3d7442bf09c4552b5f39519b21d6f88cc SHA512 f279856f234d39d369623576acf9546a1ca24d7fe449f36d4fb93ea75a7efaf2c4015b9616a69bbbed358c5e5882e16b045352f046aa4c049b3d13b1e8257b08
DIST dulwich-0.23.2.tar.gz 704361 BLAKE2B 2ba377c86a96069efa93f0e227297ba679bf04b346fe799f7b36a54bb38b51b9178c407d373a5f3e4adc4188d268ac3705a16ef98e84758cc3b8c2eaff1f5ecd SHA512 b3da400f7b89b0afd1ad14623a2a8765f2c36131f2b401ed2267637d961a65e9be32c6bb56c555d7c649d8d828088a83b433a66669b48e2a295b782fffcf9c22
DIST dulwich-0.24.1.tar.gz 806136 BLAKE2B fc8f8534c8df24cdd3c2ec6b8ce0a8c85d68fbc12aba057d1853973ea7b4a2cc0637dafa8e7c4d369b08e2d2cf5e145d323af1f23ea2afd95195072e421b3963 SHA512 705096f4822fbf8530deed78bbf2c41bf9143b19432e93a428343d0faf1ae25f6865fa777c0f1c35c94f3e6bc8fd12ab1b6f6bdaa80694bde4926846ec4f1934
DIST heck-0.5.0.crate 11517 BLAKE2B 5365ec43b2239a76b33a174f1a4292ece4147f9d382a68c6c60db78fdc8bad0afb1d51a65bcb25e96675372faa4ea37c318265030b0546ba51942f7c929e1835 SHA512 f044fc9c3d22466629fd8f772ec0555350fd611c0cfadca51d99a3d2f10e155f77c1091916c8a95a6b9b499f366c2e99a5fbf45b010f988bfb9b2501bf9f6a76
DIST indoc-2.0.6.crate 17164 BLAKE2B 1a6cff95bc12ea885ef36b935bf4f1c7870d65be0ff31ffc67dcab904fa80215c1254c1803c5d0c5686252addfad3512e9e1ec79d3edcba026a879f4706926d1 SHA512 e2ea2e5c8226c802bbe0631c1a99d2edd088cbafbf978b2a7b71c7c7f47754c6d4653f466e286441b61cc46def1c7f7a02d4785caab93a61dd785211dba7d1a9
DIST libc-0.2.174.crate 779933 BLAKE2B 20ffcbbcad6961e732521940f0595039dc0576d85b2d3b2ad3f1decd37571132a4cd7505b2e108078a4379fc4cec46290b5633bcbcc6e7009c3b474c1a852628 SHA512 243f2ffd5741ef859e4dc5b7ee0396071943b1d10429efcaecb322957e256c4be88a7a649029dfd47e6456acc73ee257893fb6c4e8b4d0fe66a12bc5d1c13c73

View File

@@ -0,0 +1,119 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CARGO_OPTIONAL=1
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..13} )
CRATES="
autocfg@1.5.0
heck@0.5.0
indoc@2.0.6
libc@0.2.174
memchr@2.7.5
memoffset@0.9.1
once_cell@1.21.3
portable-atomic@1.11.1
proc-macro2@1.0.95
pyo3-build-config@0.25.1
pyo3-ffi@0.25.1
pyo3-macros-backend@0.25.1
pyo3-macros@0.25.1
pyo3@0.25.1
quote@1.0.40
syn@2.0.104
target-lexicon@0.13.2
unicode-ident@1.0.18
unindent@0.2.4
"
inherit cargo distutils-r1 pypi
DESCRIPTION="Pure-Python implementation of the Git file formats and protocols"
HOMEPAGE="
https://github.com/jelmer/dulwich/
https://pypi.org/project/dulwich/
"
SRC_URI+="
native-extensions? (
${CARGO_CRATE_URIS}
)
"
LICENSE="GPL-2+ Apache-2.0"
LICENSE+=" native-extensions? ("
# Dependent crate licenses
LICENSE+=" Apache-2.0-with-LLVM-exceptions MIT Unicode-3.0"
LICENSE+=" )"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="doc examples +native-extensions test"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-python/urllib3-1.25[${PYTHON_USEDEP}]
"
BDEPEND="
native-extensions? (
${RUST_DEPEND}
dev-python/setuptools-rust[${PYTHON_USEDEP}]
)
test? (
${RDEPEND}
dev-python/fastimport[${PYTHON_USEDEP}]
dev-python/gpgmepy[${PYTHON_USEDEP}]
dev-python/paramiko[${PYTHON_USEDEP},server(+)]
)
"
distutils_enable_sphinx docs
PATCHES=(
"${FILESDIR}/${P}-test.patch"
)
QA_FLAGS_IGNORED="usr/lib.*/py.*/site-packages/dulwich/_.*.so"
pkg_setup() {
# avoid rust_pkg_setup which will die when there's no Rust found
if use native-extensions ; then
rust_pkg_setup # implicitly inherited through cargo
fi
}
src_unpack() {
cargo_src_unpack
}
python_compile() {
unset PURE
# TODO: enable Rust extensions
if ! use native-extensions; then
local -x PURE=1
fi
distutils-r1_python_compile
}
python_test() {
# remove interference from the tests that do stuff like user.name
unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
unset EMAIL
# Do not use make check which rebuilds the extension and uses -Werror,
# causing unexpected failures.
"${EPYTHON}" -m unittest -v tests.test_suite ||
die "tests failed with ${EPYTHON}"
}
python_install_all() {
if use examples; then
docompress -x "/usr/share/doc/${PF}/examples"
dodoc -r examples
fi
distutils-r1_python_install_all
}

View File

@@ -0,0 +1,220 @@
From 624c8f77ac17cf4e9d2017cf31a353eb9f3e41ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= <jelmer@jelmer.uk>
Date: Sat, 2 Aug 2025 15:10:36 +0100
Subject: [PATCH] Fix worktree CLI tests to properly change to repository
directory
The worktree CLI commands expect to be run from within a repository
directory. Updated the test methods to change to the repo directory
before running commands and restore the original directory afterward.
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5394104e98..5322433d5c 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -2338,12 +2338,18 @@ def setUp(self):
def test_worktree_list(self):
"""Test worktree list command."""
- io.StringIO()
- cmd = cli.cmd_worktree()
- result = cmd.run(["list"])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ io.StringIO()
+ cmd = cli.cmd_worktree()
+ result = cmd.run(["list"])
- # Should list the main worktree
- self.assertEqual(result, 0)
+ # Should list the main worktree
+ self.assertEqual(result, 0)
+ finally:
+ os.chdir(old_cwd)
def test_worktree_add(self):
"""Test worktree add command."""
@@ -2367,81 +2373,115 @@ def test_worktree_add_detached(self):
"""Test worktree add with detached HEAD."""
wt_path = os.path.join(self.test_dir, "detached-wt")
- cmd = cli.cmd_worktree()
- with patch("sys.stdout", new_callable=io.StringIO):
- result = cmd.run(["add", "--detach", wt_path])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ cmd = cli.cmd_worktree()
+ with patch("sys.stdout", new_callable=io.StringIO):
+ result = cmd.run(["add", "--detach", wt_path])
- self.assertEqual(result, 0)
- self.assertTrue(os.path.exists(wt_path))
+ self.assertEqual(result, 0)
+ self.assertTrue(os.path.exists(wt_path))
+ finally:
+ os.chdir(old_cwd)
def test_worktree_remove(self):
"""Test worktree remove command."""
# First add a worktree
wt_path = os.path.join(self.test_dir, "to-remove")
- cmd = cli.cmd_worktree()
- cmd.run(["add", wt_path])
- # Then remove it
- with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
- result = cmd.run(["remove", wt_path])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ cmd = cli.cmd_worktree()
+ cmd.run(["add", wt_path])
- self.assertEqual(result, 0)
- self.assertFalse(os.path.exists(wt_path))
- self.assertIn("Worktree removed:", mock_stdout.getvalue())
+ # Then remove it
+ with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
+ result = cmd.run(["remove", wt_path])
+
+ self.assertEqual(result, 0)
+ self.assertFalse(os.path.exists(wt_path))
+ self.assertIn("Worktree removed:", mock_stdout.getvalue())
+ finally:
+ os.chdir(old_cwd)
def test_worktree_prune(self):
"""Test worktree prune command."""
# Add a worktree and manually remove it
wt_path = os.path.join(self.test_dir, "to-prune")
- cmd = cli.cmd_worktree()
- cmd.run(["add", wt_path])
- shutil.rmtree(wt_path)
- # Prune
- with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
- result = cmd.run(["prune", "-v"])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ cmd = cli.cmd_worktree()
+ cmd.run(["add", wt_path])
+ shutil.rmtree(wt_path)
+
+ # Prune
+ with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
+ result = cmd.run(["prune", "-v"])
- self.assertEqual(result, 0)
- output = mock_stdout.getvalue()
- self.assertIn("to-prune", output)
+ self.assertEqual(result, 0)
+ output = mock_stdout.getvalue()
+ self.assertIn("to-prune", output)
+ finally:
+ os.chdir(old_cwd)
def test_worktree_lock_unlock(self):
"""Test worktree lock and unlock commands."""
# Add a worktree
wt_path = os.path.join(self.test_dir, "lockable")
- cmd = cli.cmd_worktree()
- cmd.run(["add", wt_path])
- # Lock it
- with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
- result = cmd.run(["lock", wt_path, "--reason", "Testing"])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ cmd = cli.cmd_worktree()
+ cmd.run(["add", wt_path])
- self.assertEqual(result, 0)
- self.assertIn("Worktree locked:", mock_stdout.getvalue())
+ # Lock it
+ with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
+ result = cmd.run(["lock", wt_path, "--reason", "Testing"])
- # Unlock it
- with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
- result = cmd.run(["unlock", wt_path])
+ self.assertEqual(result, 0)
+ self.assertIn("Worktree locked:", mock_stdout.getvalue())
- self.assertEqual(result, 0)
- self.assertIn("Worktree unlocked:", mock_stdout.getvalue())
+ # Unlock it
+ with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
+ result = cmd.run(["unlock", wt_path])
+
+ self.assertEqual(result, 0)
+ self.assertIn("Worktree unlocked:", mock_stdout.getvalue())
+ finally:
+ os.chdir(old_cwd)
def test_worktree_move(self):
"""Test worktree move command."""
# Add a worktree
old_path = os.path.join(self.test_dir, "old-location")
new_path = os.path.join(self.test_dir, "new-location")
- cmd = cli.cmd_worktree()
- cmd.run(["add", old_path])
- # Move it
- with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
- result = cmd.run(["move", old_path, new_path])
+ # Change to repo directory
+ old_cwd = os.getcwd()
+ os.chdir(self.repo_path)
+ try:
+ cmd = cli.cmd_worktree()
+ cmd.run(["add", old_path])
+
+ # Move it
+ with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
+ result = cmd.run(["move", old_path, new_path])
- self.assertEqual(result, 0)
- self.assertFalse(os.path.exists(old_path))
- self.assertTrue(os.path.exists(new_path))
- self.assertIn("Worktree moved:", mock_stdout.getvalue())
+ self.assertEqual(result, 0)
+ self.assertFalse(os.path.exists(old_path))
+ self.assertTrue(os.path.exists(new_path))
+ self.assertIn("Worktree moved:", mock_stdout.getvalue())
+ finally:
+ os.chdir(old_cwd)
def test_worktree_invalid_command(self):
"""Test invalid worktree subcommand."""
From 4f52beca896bb66f9a0cd0e4117474af284158e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= <jelmer@jelmer.uk>
Date: Mon, 15 Sep 2025 19:18:20 +0100
Subject: [PATCH] Support TMPDIR as example system directory in symlink test
Fixes #1885
---
tests/test_porcelain.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_porcelain.py b/tests/test_porcelain.py
index f99b588f58..b3d10423d8 100644
--- a/tests/test_porcelain.py
+++ b/tests/test_porcelain.py
@@ -1684,7 +1684,7 @@ def test_add_symlink_absolute_to_system(self) -> None:
symlink_target = os.environ["TEMP"]
else:
# On Unix-like systems, use /tmp
- symlink_target = "/tmp"
+ symlink_target = os.environ.get("TMPDIR", "/tmp")
os.symlink(symlink_target, symlink_path)
# Adding a symlink to a directory outside the repo should raise ValueError

View File

@@ -1,6 +1,10 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Michał Górny <mgorny@gentoo.org> (2025-09-15)
# Tests require dev-python/paramiko.
dev-python/dulwich test
# Michał Górny <mgorny@gentoo.org> (2025-08-05)
# Native extensions are using Rust.
dev-python/fastbencode native-extensions