From 036026ee9de9591c6a5130deb387ec2be38367b8 Mon Sep 17 00:00:00 2001
From: Yaroslav Halchenko <debian@onerussian.com>
Date: Sat, 26 Sep 2026 14:40:40 -0400
Subject: [PATCH] PATCH: rework `make bin`'s setup.py develop, now pip-based
 and network-broken

Modern setuptools' `develop` command is deprecated and now internally
shells out to `pip install -e . --target <dir>` with no --no-deps /
--no-build-isolation, which (a) requires pip to be present at all
and (b) reinstalls the full dependency closure from PyPI into <dir>,
which fails offline (e.g. in a real, network-less buildd) and even
when it doesn't fail, duplicates dependencies already satisfied by the
system's installed packages.

Call pip ourselves instead, with --no-deps (nothing here needs
datalad's dependencies re-resolved, they are already on sys.path) and
--no-build-isolation --no-index (use the ambient, already-installed
build backend; touch no network). Target build/ rather than the
project root or a bare ./bin, to keep pip's own bookkeeping
(.dist-info, the editable .pth/finder) out of the tracked source tree
and inside the existing, already-fully-cleaned build/ scratch dir;
pip's own console-script convention then places the generated scripts
at build/bin/ (not build/, and not build/bin/bin/ -- pip --target
always appends its own "bin" level for scripts, so passing "build"
here, not "build/bin", is what avoids a doubly-nested bin/bin).

Verified this still refreshes ./datalad.egg-info the same way
`setup.py develop` did (needed by debian/rules' later
`cp -rp datalad.egg-info ...`), and still produces working
console-script entry points, now at build/bin/ instead of directly
under the old --install-dir.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a10e9e5..c592a5a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ clean:
 	-find . -name '__pycache__' -type d -delete
 
 bin:
-	mkdir -p $@
-	PYTHONPATH="bin:$(PYTHONPATH)" $(PYTHON) setup.py develop --install-dir $@
+	mkdir -p build
+	$(PYTHON) -m pip install -e . --use-pep517 --no-deps --no-build-isolation --no-index --target build
 
 trailing-spaces:
 	find $(MODULE) -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
