diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh index a4f08b8b14cbd..5491e804b5433 100644 --- a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -9,10 +9,13 @@ pipInstallPhase() { mkdir -p "$out/@pythonSitePackages@" export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" + local _wheelPname="${wheelPname-$pname}" - pushd dist || return 1 - @pythonInterpreter@ -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags - popd || return 1 + if ! @pythonInterpreter@ -m pip install "${_wheelPname}" --find-links dist --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags; then + echo "Pip install failed, probably because no wheel was found. Change pname or add wheelPname." + echo "Current value: $_wheelPname. Available wheels: $(ls dist)" + exit 1 + fi runHook postInstall echo "Finished executing pipInstallPhase" @@ -22,3 +25,20 @@ if [ -z "${dontUsePipInstall-}" ] && [ -z "${installPhase-}" ]; then echo "Using pipInstallPhase" installPhase=pipInstallPhase fi + + +pipAuditTmpdir() { + local dir="$out/@pythonSitePackages@" + + echo "checking for references to $TMPDIR/ in $dir..." + + # OK if no files are found, or they don't have forbidden references + if grep "$TMPDIR/" "$dir"/*/direct_url.json; then + echo "direct_url.json contains a forbidden reference to $TMPDIR/" + exit 1 + fi +} + +if [[ -z "${noAuditTmpdir-}" ]]; then + fixupOutputHooks+=(pipAuditTmpdir) +fi diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix index a83cfc02849dd..f1ae9d74eb237 100644 --- a/pkgs/development/python-modules/bootstrapped-pip/default.nix +++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix @@ -56,7 +56,8 @@ stdenv.mkDerivation rec { echo "Building pip wheel..." pushd pip rm pyproject.toml - ${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache . + ${python.pythonForBuild.interpreter} -m pip wheel --wheel-dir dist --no-build-isolation --no-index --no-dependencies --no-cache . + ${python.pythonForBuild.interpreter} -m pip install pip --find-links dist --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache popd ''; diff --git a/pkgs/development/python-modules/lz4/default.nix b/pkgs/development/python-modules/lz4/default.nix index ed06dca7c4c5a..2bf7e79c83859 100644 --- a/pkgs/development/python-modules/lz4/default.nix +++ b/pkgs/development/python-modules/lz4/default.nix @@ -10,7 +10,7 @@ }: buildPythonPackage rec { - pname = "python-lz4"; + pname = "lz4"; version = "4.3.2"; format = "setuptools"; diff --git a/pkgs/development/python-modules/twisted/default.nix b/pkgs/development/python-modules/twisted/default.nix index 0731822c3bc67..a15ecd21f1047 100644 --- a/pkgs/development/python-modules/twisted/default.nix +++ b/pkgs/development/python-modules/twisted/default.nix @@ -48,11 +48,12 @@ buildPythonPackage rec { pname = "twisted"; version = "22.10.0"; format = "setuptools"; + wheelPname = "Twisted"; disabled = pythonOlder "3.6"; src = fetchPypi { - pname = "Twisted"; + pname = wheelPname; inherit version; extension = "tar.gz"; hash = "sha256-Mqy9QKlPX0bntCwQm/riswIlCUVWF4Oot6BZBI8tTTE=";