about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh')
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh
new file mode 100644
index 000000000000..af9ed60a038d
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/conda-install-hook.sh
@@ -0,0 +1,27 @@
+# Setup hook to use in case a conda binary package is installed
+echo "Sourcing conda install hook"
+
+condaInstallPhase(){
+    echo "Executing condaInstallPhase"
+    runHook preInstall
+
+    # There are two different formats of conda packages.
+    # It either contains only a site-packages directory
+    # or multiple top level directories.
+    siteDir=@pythonSitePackages@
+    if [ -e ./site-packages ]; then
+      mkdir -p $out/$siteDir
+      cp -r ./site-packages/* $out/$siteDir
+    else
+      cp -r . $out
+      rm $out/env-vars
+    fi
+
+    runHook postInstall
+    echo "Finished executing condaInstallPhase"
+}
+
+if [ -z "${installPhase-}" ]; then
+    echo "Using condaInstallPhase"
+    installPhase=condaInstallPhase
+fi