buildPythonPackage: add support for conda
This commit is contained in:
committed by
Frederik Rietdijk
parent
ae3d04bf55
commit
6c0b85cf3a
@@ -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
|
||||
@@ -0,0 +1,18 @@
|
||||
# Setup hook to use in case a conda binary package is fetched
|
||||
echo "Sourcing conda unpack hook"
|
||||
|
||||
condaUnpackPhase(){
|
||||
echo "Executing condaUnpackPhase"
|
||||
runHook preUnpack
|
||||
|
||||
# use lbzip2 for parallel decompression (bz2 is slow)
|
||||
lbzip2 -dc -n $NIX_BUILD_CORES $src | tar --exclude='info' -x
|
||||
|
||||
# runHook postUnpack # Calls find...?
|
||||
echo "Finished executing condaUnpackPhase"
|
||||
}
|
||||
|
||||
if [ -z "${unpackPhase-}" ]; then
|
||||
echo "Using condaUnpackPhase"
|
||||
unpackPhase=condaUnpackPhase
|
||||
fi
|
||||
@@ -16,6 +16,21 @@ let
|
||||
setuppy = ../run_setup.py;
|
||||
in rec {
|
||||
|
||||
condaInstallHook = callPackage ({ gnutar, lbzip2 }:
|
||||
makeSetupHook {
|
||||
name = "conda-install-hook";
|
||||
deps = [ gnutar lbzip2 ];
|
||||
substitutions = {
|
||||
inherit pythonSitePackages;
|
||||
};
|
||||
} ./conda-install-hook.sh) {};
|
||||
|
||||
condaUnpackHook = callPackage ({}:
|
||||
makeSetupHook {
|
||||
name = "conda-unpack-hook";
|
||||
deps = [];
|
||||
} ./conda-unpack-hook.sh) {};
|
||||
|
||||
eggBuildHook = callPackage ({ }:
|
||||
makeSetupHook {
|
||||
name = "egg-build-hook.sh";
|
||||
|
||||
Reference in New Issue
Block a user