diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-15 10:30:44 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-15 10:30:44 +0000 |
commit | e0794be8a0d11e90461e5a9c85012a36b93ec976 (patch) | |
tree | efd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/development/interpreters/python/hooks | |
parent | 3538874082ded7647b1ccec0343c7c1e882cfef3 (diff) | |
parent | 1a57d96edd156958b12782e8c8b6a374142a7248 (diff) | |
download | nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2 nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip |
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/hooks')
3 files changed, 11 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix index d14eb9cbb09d..1a64c79232bc 100644 --- a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix @@ -1,14 +1,15 @@ # Hooks for building Python packages. { python , lib -, callPackage , makeSetupHook , disabledIf , isPy3k , ensureNewerSourcesForZipFilesHook +, findutils }: let + callPackage = python.pythonForBuild.pkgs.callPackage; pythonInterpreter = python.pythonForBuild.interpreter; pythonSitePackages = python.sitePackages; pythonCheckInterpreter = python.interpreter; @@ -94,7 +95,7 @@ in rec { makeSetupHook { name = "python-namespaces-hook.sh"; substitutions = { - inherit pythonSitePackages; + inherit pythonSitePackages findutils; }; } ./python-namespaces-hook.sh) {}; diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh index 770739b36bde..a4f08b8b14cb 100644 --- a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -11,9 +11,7 @@ pipInstallPhase() { export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" pushd dist || return 1 - mkdir tmpbuild - NIX_PIP_INSTALL_TMPDIR=tmpbuild @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags - rm -rf tmpbuild + @pythonInterpreter@ -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags popd || return 1 runHook postInstall diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh index 50f21819d176..15d2bd0eb34c 100644 --- a/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh @@ -17,16 +17,17 @@ pythonNamespacesHook() { for pathSegment in ${pathSegments[@]}; do constructedPath=${constructedPath}/${pathSegment} pathToRemove=${constructedPath}/__init__.py - pycachePath=${constructedPath}/__pycache__/__init__* + pycachePath=${constructedPath}/__pycache__/ + # remove __init__.py if [ -f "$pathToRemove" ]; then - echo "Removing $pathToRemove" - rm "$pathToRemove" + rm -v "$pathToRemove" fi - if [ -f "$pycachePath" ]; then - echo "Removing $pycachePath" - rm "$pycachePath" + # remove __pycache__/ entry, can be interpreter specific. E.g. __init__.cpython-38.pyc + # use null characters to perserve potential whitespace in filepath + if [ -d "$pycachePath" ]; then + @findutils@/bin/find "$pycachePath" -name '__init__*' -exec rm -v "{}" + fi done done |