From 7a65bb76f1db44f8af6e13d81d13f41d69fb1948 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Tue, 23 Mar 2021 11:27:27 +0100 Subject: [PATCH] pythonPackages: fix editable setuptools installations --- .../interpreters/python/hooks/setuptools-build-hook.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh index 311590425e6..cc037744925 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -31,6 +31,13 @@ setuptoolsShellHook() { mkdir -p "$tmp_path/@pythonSitePackages@" eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \ --no-build-isolation >&2" + + # Process pth file installed in tmp path. This allows one to + # actually import the editable installation. Note site.addsitedir + # appends, not prepends, new paths. Hence, it is not possible to override + # an existing installation of the package. + # https://github.com/pypa/setuptools/issues/2612 + export NIX_PYTHONPATH="$tmp_path/@pythonSitePackages@:${NIX_PYTHONPATH-}" fi runHook postShellHook