Package: src:datalad
Version: 1.3.1-2
User: [email protected]
Usertags: python3.15
Tags: patch, ftbfs, forky, sid
Severity: important

Hi!

While rebuilding the python related packages against the Python 3.15rc2
version we found that datalad fails to build from source [1].

The error was:
Download error on https://pypi.org/simple/keyrings.alt/: [Errno -3] Temporary 
failure in name resolution -- Some packages may not be found!

To fix this and other issues, I had to make a number of changes to the
package:
- Make sure it doesn't use the network while building
- Add upstream patch 8f078923de85308307efbd5ea1f1cfa199d8d190: fix:
  Avoid use of return in a finally block
- Add patch to use fork with multiprocessing, avoid using the forkserver
- Avoid using the setuptools deprecated develop call
- Ignore commonprefix deprecation warning
- Update PYBUILD_BEFORE_TEST to ensure bin/ shims are regenerated

I've applied these fixes in the sandbox [2] to verify that it builds
successfully, please consider applying the patch to support the upcoming
3.15 version.

Setting the severity to important for now. Once Python 3.15 is released,
it will be added to python3-defaults and this bug will become release
critical.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4514128/
[2]: https://debusine.debian.net/debian/r-python-python3.15/

--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
diff --git a/debian/changelog b/debian/changelog
index 9a9c37406..c9b038d7d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+datalad (1.3.1-3) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Add --no-deps to setup.py develop
+  * Fix Python 3.15 test failures: ignore commonprefix deprecation warning and set multiprocessing start method to fork
+  * Use pip install instead of deprecated setup.py develop
+  * Add python3-pip to Build-Depends
+
+ -- Maximiliano Curia <[email protected]>  Tue, 15 Sep 2026 11:54:20 +0200
+
 datalad (1.3.1-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/deb_disable_pytest_warn b/debian/patches/deb_disable_pytest_warn
index 8504d2be2..2bc5444ba 100644
--- a/debian/patches/deb_disable_pytest_warn
+++ b/debian/patches/deb_disable_pytest_warn
@@ -9,10 +9,11 @@ Last-Update: 2022-09-23
 
 --- a/tox.ini
 +++ b/tox.ini
-@@ -68,10 +68,6 @@ commands = sphinx-build -E -W -b html so
+@@ -68,10 +68,7 @@ commands = sphinx-build -E -W -b html so
  [pytest]
  filterwarnings =
      error::DeprecationWarning:^datalad
++    ignore:os.path.commonprefix\(\) is deprecated:DeprecationWarning
 -    # TODO: https://github.com/datalad/datalad/issues/7435
 -    ignore:pkg_resources is deprecated:DeprecationWarning:
 -    error:.*yield tests:pytest.PytestCollectionWarning
diff --git a/debian/patches/fix-finally-return.patch b/debian/patches/fix-finally-return.patch
new file mode 100644
index 000000000..45cb99c98
--- /dev/null
+++ b/debian/patches/fix-finally-return.patch
@@ -0,0 +1,34 @@
+From 8f078923de85308307efbd5ea1f1cfa199d8d190 Mon Sep 17 00:00:00 2001
+From: "Christopher J. Markiewicz" <[email protected]>
+Date: Thu, 5 Mar 2026 14:58:49 -0500
+Subject: [PATCH] fix: Avoid use of return in a finally block
+
+---
+ datalad/utils.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/datalad/utils.py b/datalad/utils.py
+index 8e037b966..b3eba3197 100644
+--- a/datalad/utils.py
++++ b/datalad/utils.py
+@@ -1975,12 +1975,12 @@ def make_tempfile(content: str | bytes | None = None, wrapped: Optional[Callable
+             # For paranoid yoh who stepped into this already ones ;-)
+             lgr.warning("It is unlikely that it was intended to remove all"
+                         " files matching %r. Skipping" % filename_)
+-            return
+-        for f in filenames:
+-            try:
+-                rmtemp(f)
+-            except OSError:  # pragma: no cover
+-                pass
++        else:
++            for f in filenames:
++                try:
++                    rmtemp(f)
++                except OSError:  # pragma: no cover
++                    pass
+ 
+ 
+ def _path_(*p: str) -> str:
+-- 
+2.53.0
diff --git a/debian/patches/py315-multiprocessing.patch b/debian/patches/py315-multiprocessing.patch
new file mode 100644
index 000000000..14227f210
--- /dev/null
+++ b/debian/patches/py315-multiprocessing.patch
@@ -0,0 +1,24 @@
+Description: Set multiprocessing start method to fork for test suite
+ Under Python 3.15, forkserver is the default start method on POSIX, which
+ fails in the test harness when tracking child processes across runners.
+Author: Maximiliano Curia <[email protected]>
+Forwarded: not-needed
+
+Index: datalad/datalad/conftest.py
+===================================================================
+--- datalad.orig/datalad/conftest.py
++++ datalad/datalad/conftest.py
+@@ -28,6 +28,13 @@ test_http_server = None
+ @pytest.fixture(autouse=True, scope="session")
+ def setup_package():
+     import tempfile
++    import multiprocessing
++
++    if 'fork' in multiprocessing.get_all_start_methods():
++        try:
++            multiprocessing.set_start_method('fork')
++        except RuntimeError:
++            pass
+ 
+     from datalad import consts
+     from datalad.support.annexrepo import AnnexRepo
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 4d9963666..3a6b23de6 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -3,8 +3,10 @@ Description: use python3 interpreter, not python by default in Makefile
   are no longer needed/adopted upstream
 Last-Modified: 2019-09-06
 
---- a/Makefile
-+++ b/Makefile
+Index: datalad/Makefile
+===================================================================
+--- datalad.orig/Makefile
++++ datalad/Makefile
 @@ -1,7 +1,7 @@
  # simple makefile to simplify repetitive build env management tasks under posix
  # Ideas borrowed from scikit-learn's and PyMVPA Makefiles  -- thanks!
@@ -14,3 +16,12 @@ Last-Modified: 2019-09-06
  
  MODULE ?= datalad
  
+@@ -15,7 +15,7 @@ clean:
+ 
+ bin:
+ 	mkdir -p $@
+-	PYTHONPATH="bin:$(PYTHONPATH)" $(PYTHON) setup.py develop --install-dir $@
++	PYTHONPATH="bin:$(PYTHONPATH)" $(PYTHON) setup.py install_scripts --install-dir $@
+ 
+ trailing-spaces:
+ 	find $(MODULE) -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
diff --git a/debian/patches/series b/debian/patches/series
index 34078900b..0fd581549 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,5 @@ deb_disable_pytest_warn
 deb_no_utf8
 python3.patch
 deb-looseversion.patch
+fix-finally-return.patch
+py315-multiprocessing.patch
diff --git a/debian/rules b/debian/rules
index 45e1cd36b..361e877e7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,7 @@ export https_proxy=
 
 # We need to copy .egg-info so entry points are discovered. And also need
 # to generate then per-Python version since some module requirements differ
-export PYBUILD_BEFORE_TEST=PYTHONPATH=$(CURDIR)/bin python{version} setup.py develop --install-dir bin/ && cp -rp datalad.egg-info {build_dir}/;
+export PYBUILD_BEFORE_TEST=PYTHONPATH=$(CURDIR)/bin python{version} setup.py install_scripts --install-dir bin/ && cp -rp datalad.egg-info {build_dir}/;
 
 # Set SOURCE_DATE_EPOCH based on changelog in a most portable (older dpkg) way
 # following https://reproducible-builds.org/docs/source-date-epoch/
@@ -28,11 +28,11 @@ export DATALAD_SOURCE_EPOCH=$(SOURCE_DATE_EPOCH)
 
 clean::
 	dh_clean
-	-rm -rf bin build .pybuild datalad.egg-info .pytest_cache docs/source/generated/man
+	-rm -rf bin build .pybuild datalad.egg-info *.dist-info .pytest_cache docs/source/generated/man
 	-find . -name '*.pyc' -delete
 
 override_dh_auto_configure:
-	# cheap fake of an installed datalad, so we get .egg-info with entry points
+	# cheap fake of an installed datalad, so we get metadata with entry points
 	$(MAKE) bin
 	# and leave the rest for dh_python* runs
 	mkdir -p build; \

Reply via email to