about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/hooks
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-10-08 10:15:02 +0200
committerJörg Thalheim <joerg@thalheim.io>2022-10-17 10:12:34 +0200
commit12f9d8e7303af57ed2d462c17b772c36fd05d0ea (patch)
tree7da458d14ef320aa9d24d875a3e92257bdb894d4 /pkgs/development/interpreters/python/hooks
parentf3500ee0293e230bc06b6636f5fa012cfbff5f81 (diff)
downloadnixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar.gz
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar.bz2
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar.lz
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar.xz
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.tar.zst
nixlib-12f9d8e7303af57ed2d462c17b772c36fd05d0ea.zip
buildPythonPackage: better error message if no setuptools is used.
Before packages did not had to set `format = "other";` if had a custom
installPhase and would not produce a dist folder.
The current error message is hard to understand by new users:

> Executing pythonOutputDistPhase
> mv: cannot stat 'dist': No such file or directory

This commit improves the error message.
Diffstat (limited to 'pkgs/development/interpreters/python/hooks')
-rw-r--r--pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh b/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh
index e73e45cd597a..83b79d01fa40 100644
--- a/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh
+++ b/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh
@@ -3,7 +3,21 @@ echo "Sourcing python-catch-conflicts-hook.sh"
 
 pythonOutputDistPhase() {
     echo "Executing pythonOutputDistPhase"
-    mv "dist" "$dist"
+    if [[ -d dist ]]; then
+        mv "dist" "$dist"
+    else
+        cat >&2 <<EOF
+The build contains no ./dist directory.
+If this project is not setuptools-based, pass
+
+  format = "other";
+
+to buildPythonApplication/buildPythonPackage or another appropriate value as described here:
+
+  https://nixos.org/manual/nixpkgs/stable/#buildpythonpackage-function
+EOF
+        false
+    fi
     echo "Finished executing pythonOutputDistPhase"
 }