From bff6c67911ed74cf560bd2b00fb1da32bd2fed63 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Tue, 2 May 2023 13:38:52 +0100 Subject: [PATCH] python.pipInstallHook: avoid producing wrong direct_url.json file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When installing many python packages, a `direct_url.json` file appeared in the lib directory. Example: ```sh ➤ nix build nixpkgs/29755fec55e58a315b517d431b2be261772f2b80#python3Packages.flask ➤ cat result/lib/python3.10/site-packages/Flask-2.2.3.dist-info/direct_url.json {"archive_info": {}, "url": "file:///build/Flask-2.2.3/dist/Flask-2.2.3-py3-none-any.whl"}⏎ ``` As you can see, that file contains a wrong reference to `/build`. In https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012/4 there's an explanation on how to avoid this. Here, I'm implementing that change for nixpkgs. @moduon MT-1075 --- .../development/interpreters/python/hooks/pip-install-hook.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh index a4f08b8b14cb..f6fae14aa8d3 100644 --- a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -10,9 +10,7 @@ pipInstallPhase() { mkdir -p "$out/@pythonSitePackages@" export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" - pushd dist || return 1 - @pythonInterpreter@ -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags - popd || return 1 + @pythonInterpreter@ -m pip install $pname --find-links dist --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags runHook postInstall echo "Finished executing pipInstallPhase"