summaryrefslogtreecommitdiff
path: root/pkgs/development/interpreters/python/hooks/conda-install-hook.sh
blob: 437ca46ff97c0f0b43ebaab2d020ceaf5f8dfa23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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